Javascript eval on global scope?

后端 未结 6 837
长发绾君心
长发绾君心 2020-12-01 10:33

Is it possible to use the eval command to execute something with a global scope? For example, this will cause an error:



        
6条回答
  •  既然无缘
    2020-12-01 10:55

    Use eval.apply(null, ["code"]);.

    eval.apply(this, ["code"]); does not work on Microsoft Script Host (cscript.exe).

提交回复
热议问题