Re:Is eval evil? Just-in-time compiling
by sbr464 on Tuesday November 20, 2018 @07:32AM
(#18493347)
I saw a trick where you just do:
const eval2 = eval
eval2(...)
That put’s it back in global scope, even when assigned within a closure with access to a local variable. The local variable will be undefined, rather than it’s actual value, even when called next to the regular eval(). Odd, I know.
Here’s a quote:
"any invocation of eval that is not a direct call uses the global environment as its variable environment rather than the caller’s variable environment." ECMAScript 5 standard,
Here’s a quote:
"any invocation of eval that is not a direct call uses the global environment as its variable environment rather than the caller’s variable environment." ECMAScript 5 standard,