Changing `array.each()` to use a `for` loop instead of a `while` based on http://jsperf.com/array-foreach/2