且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

(function(){})() 之间的区别;和函数(){}();

更新时间:2023-12-04 11:31:34

Peter Michaux 讨论了 一对重要的父母.

Peter Michaux discusses the difference in An Important Pair of Parens.

基本上括号是一种约定,表示紧随其后的是立即调用的函数表达式,而不是普通函数.特别是如果函数体很长,这会减少惊喜,

Basically the parentheses are a convention to denote that an immediately invoked function expression is following, not a plain function. Especially if the function body is lengthy, this reduces surprises,