Categories
Posts

JavaScript Performance: for vs. foreach

I ran across a jsperf.com test of a for loop vs foreach and I was surprised at the difference when running the test in Chrome 38:

js-for-foreach

The for loop consistently came out over 40 times faster than the foreach.

4 replies on “JavaScript Performance: for vs. foreach”

Leave a Reply

Your email address will not be published. Required fields are marked *