Javascript eval on global scope?

    eval.apply(this, arguments);

This will invoke eval using the global object, window in browsers, as the this argument passing any arguments you’ve passed into the anonymous function., x, y, z) or eval.apply(window, arguments) is also valid if you’re certain window is the global object. This isn’t always true, however. For instance, the global object in a Node.js script is process if I remember correctly.

Leave a Comment