I use a for loop here because we want to short-circuit the loop after the first `limit` number of elements. I considered first slicing the array to the first `limit` elements and then calling forEach on that array, but this was about 3% faster according to JSPerf.com. (This is actually a little surprising, because although `Array.slice()` ostensibly returns a new array, I would have guessed that V8 would return a copy-on-write reference to the original. Maybe it does, but if so I can't explain the performance difference.)