Transpile for-of loops into simple array iterators
Similar to the behaviour in TypeScript when the compilation target is ES5 (which lacks Symbol.iterator
anyway), a for of
loop is transpiled into a simple array iterator. For example,
for (let link of document.querySelectorAll('a')) {
link.setAttribute('href', '');
}
will be transpiled into
for (var _i = 0, _a = document.querySelectorAll('a'); _i < _a.length; _i++) {
var link = _a[_i];
link.setAttribute('href', '');
}
Will that be a good idea?