Re:Ask YC: Fewer lines of clever code or more lines of clear...
by tlrobinson on Sunday June 22, 2008 @10:31PM
(#224620)
1. With better formatting it would be more readable. It's hard keeping track of the parens and braces.
2. What's with the call to parseInt? Are you trying to floor it? If so, just use Math.floor()
3. If you know the number of parameters to a function call you can use method.call(this, arg1) instead of method.apply(this, [arg1]). Slightly more readable, IMO.
Overall I would say this is a little too clever. I'd use a few extra lines to make it more clear.
2. What's with the call to parseInt? Are you trying to floor it? If so, just use Math.floor()
3. If you know the number of parameters to a function call you can use method.call(this, arg1) instead of method.apply(this, [arg1]). Slightly more readable, IMO.
Overall I would say this is a little too clever. I'd use a few extra lines to make it more clear.