+ 1
For (i in array) vs for (i = 0;i<array.length;i++)
Following a tutorial recently I noticed the use of both ways of using the for loop : For (i in array) vs for (i = 0;i<array.length;i++) but is there any difference between these?
2 Answers
+ 11
in the second one you can access the index of the array (i) which might be very helpful in some situations
+ 1
here is also forEach ...
and for of in ES6