是否有可能在纯JavaScript中重新实现'function'或'eval'?例如。可以说,我希望能写:是否有可能在JavaScript中推出自己的'函数'构造或'eval'方法?
// note that I don't want to have to put code in a string here
var x = func() { var something = "nothing"; return something; }
或
var hiString = 'hi' // note that it of course needs to be able to access the current context
evaluatize("function hi(){ alert(hiString); } hi();")
在javascript要么这些事情可能吗?
这样的声音就是答案.. – 2011-03-05 23:38:32