JSFiddle - React, Tailwind, and code Playground
by Ian Oxley
JavaScript
// Loop closure 'out of scope'
for (var i = 0; i < 10; i++) {
console.log('no callback: ' + i);
setTimeout(function() {
console.log('with callback: ' + i);
}, 5000);
}