Eval in global scope under wscript

281 Views Asked by At

Is there a way to fully emulate a global eval() call from within a function call? I've tried various methods and cannot find a suitable solution that works under wscript:

var Global = this;
function globalEval(code) {
    (1, eval).call(Global, code);
}
globalEval('var foo = "bar"');
WScript.echo(foo); // undefined

Other methods I've tried:

eval.call(Global, code);
Global.eval.call(Global, code);
new Function(code);
(1, eval)(code)
0

There are 0 best solutions below