JSFiddle - React, Tailwind, and code Playground
by ben336
JavaScript 1.7
var funcs = {};
for (var i = 0; i < 3; i++) { // let's create 3 functions
let c = i;
funcs[i] = function() { // and store them in funcs
console.log("My value: " + c); // each should log its value.
};
}
for (var j = 0; j < 3; j++) {
funcs[j](); // and now let's run each one to see
}