새로운 기능이 여기에서 작동하지 않는 이유를 아는 사람이 있습니까?Javascript 함수 String에서 생성자가 실행되지 않습니다.
var fn = data["callback"]; // String with value: function() { anotherFunctionToRun(); }
var foo = new Function("return ("+fn+")");
foo();
alert(foo) // returns function anonymous() { return function() {anotherFunctionToRun();}; }
alert(foo()) // function() { anotherFunctionToRun(); }
foo(); // Wont do anything
구문에 이상이 있습니까?
빠른 응답을 보내 주셔서 감사합니다. – Gomer