Is defining every variable at the top always the best approach?
I’d highly suggest giving Code Complete 2 by Steve McConnell a read. His argument is that you should neither declare all of your variables in one line, nor should should declare them all at the top of a routine. So, don’t do this: function foo() { var a, b, c, d; /** * 20 lines … Read more