From JavaScript Garden, a great resource on the quirks of JavaScript.
Although the length property is defined on the array itself, there is
still an overhead for doing the lookup on each iteration of the loop.
And while recent JavaScript engines may apply optimization in this
case, there is no way of telling whether the code will run on one of
these newer engines or not.