I agree about declaring variables at the beginning of the function, but not about "saving up some bytes and making the code look uglier", that's just premature optimization and unnecessary if you're minimizing your code later (Concat+UglifyJS+gzip). I'll only recommend this if you're working on a project of your own, but for other developers it might be harder to read.
I agree about declaring variables at the beginning of the function, but not about "saving up some bytes and making the code look uglier", that's just premature optimization and unnecessary if you're minimizing your code later (Concat+UglifyJS+gzip). I'll only recommend this if you're working on a project of your own, but for other developers it might be harder to read.
Also, Crockford.