DEV Community

Discussion on: Make Your Code Cleaner, Shorter and Easier to Read! ES6 Tips and Tricks.

Collapse
 
faabiopontes profile image
Fabio Pontes

Nice article, nicely summary of ES6 Tips and Tricks. The for has a typo.

for (var i = 1, i < 5, i++){ // for is separated with ; instead of ,
    setTimeout(() => { console.log(i); }, 1000);
}

Correct one:

for (var i = 1; i < 5; i++){
    setTimeout(() => { console.log(i); }, 1000);
}
Collapse
 
samwsoftware profile image
Sam Williams

Thanks, I must have been on auto pilot!