var str = "console.log('222');console.log(111)"; //这样的话可以执行var tempFun = new Function(str); tempFun();
然后 我把 两句之间的分号去掉
var str = "console.log('222') console.log(111)"; //现在这样就会报错var tempFun = new Function(str); tempFun();
我不太明白为什么 平时我们写的话 不是可以不加分号吗?
湖上湖
梵蒂冈之花
相关分类