The for-of syntax was introduced in ES6. On older browsers, this syntax is transpiled down to ES5. Since for-of is based upon the iterable protocol, the generated code is bloated and nonperformant. If your app supports older browsers, use a standard for
instead.
Example of incorrect code:
const arr = [1, 2, 3];
for (let item of arr) {
console.log(item);
}
Example of correct code:
const arr = [1, 2, 3];
for (let i = 0; i < arr.length; i++) {
console.log(i);
}