Member-only story
How to Iterate Over Javascript Arrays — Performance Comparison
This article compares three different ways to iterate over a JavaScript array and compares the performance of each approach.
Technique 1 : For Loop
For loop is a common semantic available in most of the languages to repeat the same set of instructions till a certain condition is satisfied. This concept can be used to traverse over the arrays in JavaScript.
Technique 2 : For In
For in statement can be used to iterate over all the enumerable properties of javascript Arrays and Objects. Order is not guaranteed in this technique.
What are Enumerable Properties?
Properties created via simple assignment or via a property initializer.