In JavaScript, what is the advantage of !function(){}() over (function () {})()? [duplicate]
- 阅读更多 关于 In JavaScript, what is the advantage of !function(){}() over (function () {})()? [duplicate]
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: What does the exclamation mark do before the function? I've long used the following for self-executing, anonymous functions in JavaScript: (function () { /* magic happens */ })() Lately, I've started seeing more instances of the following pattern (e.g., in Bootstrap): !function () { /* presumably the same magic happens */ }() Anyone know what the advantage is of the second pattern? Or, is it just a stylistic