是否有可能在純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