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

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

WBOY
WBOYOriginal
2016-06-06 20:12:23849browse

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

回复内容:

<code>问题已经解决了,但是楼下的回答很牛,但是是在评论里..希望对大家有帮助!</code>
<code>var foo02 = new function()  
 {  
     var temp = 100;  
     this.temp = 200;  
     return temp + this.temp;  
 } </code>
<code>var foo3 = new Function('var temp = 100; this.temp = 200; return temp + this.temp;');  </code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn