Possible Duplicate:
What does this “(function(){});”, a function inside brackets, mean in javascript ?
(function(){
---this code at here ----
})();
What does (function(){})(); mean? Please explain it to me.
It makes an anonymous function and executes it. You use it to prevent variables from poluting the global scope.
(function(){
var test = "Hello";
})();
alert(test); //test will be undefined here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With