Ben Alman » Multiple var statements in JavaScript, not superfluous. I think I’m in denial about the potentials for major issues with combined var statements. I use the style because Crockford does, and I am irrationally likely to take what he says as gospel. This is a great dissection of the practice.
Monthly Archives: May 2012
JavaScript Scoping and Hoisting
Adequately Good – JavaScript Scoping and Hoisting – by Ben Cherry. I was not aware at all of “hoisting” in JavaScript, which causes your variable declarations (but not initializations) to be rearranged to the top of your function scope by the interpreter. Function definitions, however, are hoisted along with the function body. Implications: potentially unexpected behavior […]