I am Hack Sparrow
Captain of the Internets.

Should you use “var” for initializing counter variables in For / For Each loops?

To var, or not to var, that is the question. - Bill Shakespeare What difference does the use of var in the loop constructs make? (more…) ...

The For Loop vs the For Each Loop in JavaScript

When do you use the For Loop and the For Each Loop in JavaScript? The answers to that question depends entirely on your requirement. The For Loop is best for iterating over name-value pairs, and the For Each Loop best for iterating over values, for example arrays. Neither is better or worse than the other, but understanding how they work will help you make the best use of them. Observe the examples below. ...