文档地址:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval
let text = 'hello world'
eval("!function x(){console.log(`${text}`)}()");
Function(!function x(){console.log(`${text}`)}()
)()
//上面两条语句的执行结果是一致的,eval不建议使用
let a=1;
//new Function()中的参数要跟function(a,c)中的保持一致
x = function (a,c) {
return new Function('a', 'c','!function (){console.log(a,c)}()');
}();
let b = x(a,2)
let y = new Function('console.log("hello")');
y()