JSFiddle - React, Tailwind, and code Playground
by LyndseyB
JavaScript
function doSomething(i) {
console.log('current = ' + i);
}
var callbackFuncs = [];
for(var i = 1; i <= 4; i++) {
callbackFuncs.push(doSomething.bind(this, i));
}
callbackFuncs.forEach(function(fun) {
fun();
});