The let/const plugin can add closures where you don't expect them. This is undesirable in some perf-sensitive projects (ex: React). I added an option that throws whenever the plugin adds a function (as opposed to simply renaming variables when converting to var).
7 lines
102 B
JavaScript
7 lines
102 B
JavaScript
for (let i = 0; i < 5; i++) {
|
|
const l = i;
|
|
setTimeout(function() {
|
|
console.log(l);
|
|
}, 1);
|
|
}
|