JSFiddle - React, Tailwind, and code Playground
JavaScript
function sqFnList(a){
var b = [];
for ( var i = 0; i <a.length; i++)
{
var sq = a[i] * a[i];
b[i] = function (the_sq) {
return function() { return the_sq;}
}(sq);
}
return b;
}
x = sqFnList([3,4,5])[1]()
// alert(x)