📜  javascript eval 传递变量 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:49.898000             🧑  作者: Mango

代码示例1
// Code you want to evaluate
var code = 'return this.whatever'

// What you want "this" bound to:
var that = { whatever: 69 }

// Now do this:
var result = new Function(code).call(that)