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
This worked for me the best:
const scopedEval = (scope, script) => Function(`"use strict"; ${script}`).bind(scope)();
Usage:
scopedEval({a:1,b:2},"return this.a+this.b")