Possible Duplicate:
JavaScript scope and closure
What is this for?
(function(){
//The code to be executed
})();
Also, has this anything to do with closures?
I've seen it often recently. I'm guessing:
No need to name the function. It implies it's not reusable.
This gives you a local scope to declare variables using var
(otherwise, you would add them to global).
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