I usually cache the value of .length in a local variable. In theory, V8 knows it's loop invariant and optimizes away the lookup. In practice, it doesn't (always?) seem to do it.