Javascript simple for loop versus for...of performances

Viewed 272

I have seen that since ECMA 6 we can use for...of instead of the traditionnal for loop:

for( let i = 0 ; i < arr.length ; i++ ) {
    var elm = arr[i];
    // do stuff
}

VS

for( let elm of arr ) {
    // do stuff
}

Has you see the second one is lot more readable, simple and maintainable!

I just wonder how performant the second syntax is as I need to use it a lot in a render loop (60 times per seconds) for a game.

Have you got a clue ?

3 Answers
Related