2 ms·
Unfortunately, eval() complicates things. Consider: function foo (x) { return function(what) { return eval(what); }; } var
by Twisol 15y ago
Unfortunately, eval() complicates things. Consider:
function foo (x) {
return function(what) {
return eval(what);
};
}
var theClosure = foo(42);
var theX = theClosure("x");
document.write(theX); // displays 42
Even though "x" is never explicitly used, it's still accessible through the eval'd expression.