6
const iterable = [0, 1, 2];
for (let i of iterable) {
console.log(i);
}
Expected output:
0
1
2
The advantages from the for...of loop are:
This is the most concise, direct syntax yet for looping through array elements
It avoids all the pitfalls of for...in
Unlike forEach(), ...