▲ Understanding Scope in JavaScript at developer.telerik.com▼1 up and 1 down, posted by remotesynth 2679 days ago 1 comment
xat 2679 days ago. link 2 points ▲ ▼Not sure if this was made 100% clear in the article (although it's mentioned), but instead of an IIFE you can also use 'let' in the last example: for (let i = 0; i < 5; i++) { setTimeout(function () { console.log('index: ' + i); }, 1000); }