0

guys i want to know is there any different between this anonymous :

first :

(function(){
   //statements
})();

second :

(function(){
   //statements
}());

third :

!function(){
   //statmeents
}();

i need a clear explanation about this , thanks all :D

anztrax
  • 669
  • 7
  • 9
  • This should answer your question: http://stackoverflow.com/questions/5827290/javascript-function-leading-bang-syntax – pmckeown Aug 26 '13 at 03:05

1 Answers1

2

The one and only difference is that the last variation uses fewer bytes.

All three use the language's syntax rules to force the function to be a function expression (which can be immediately invoked) rather than a function declaration (which cannot be invoked, must be named, and is subject to hoisting).

josh3736
  • 124,335
  • 26
  • 203
  • 248