当前位置:Gxlcms > PHP教程 > JavaScript中function和Function除了能省略一个括号之外,还有什么区别?

JavaScript中function和Function除了能省略一个括号之外,还有什么区别?

时间:2021-07-01 10:21:17 帮助过:25人阅读

  1. <code>问题已经解决了,但是楼下的回答很牛,但是是在评论里..希望对大家有帮助!</code>
  1. <code>var foo02 = new function()
  2. {
  3. var temp = 100;
  4. this.temp = 200;
  5. return temp + this.temp;
  6. } </code>
  1. <code>var foo3 = new Function('var temp = 100; this.temp = 200; return temp + this.temp;'); </code>

回复内容:

  1. <code>问题已经解决了,但是楼下的回答很牛,但是是在评论里..希望对大家有帮助!</code>
  1. <code>var foo02 = new function()
  2. {
  3. var temp = 100;
  4. this.temp = 200;
  5. return temp + this.temp;
  6. } </code>
  1. <code>var foo3 = new Function('var temp = 100; this.temp = 200; return temp + this.temp;'); </code>

人气教程排行