Specify scope for eval() in JavaScript?

后端 未结 9 1260
心在旅途
心在旅途 2020-11-27 07:24

is there any way I can execute eval() on a specific scope (but NOT global)?

for example, the following code doesn\'t work (a is undefined on the sec

9条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 07:46

    You can look into the vm-browserify project, which would be used in conjunction with browserify.

    It works by creating