I commonly see both conventions and I'm wondering if there's an actual difference.
(function () {
document.write("it works");
}());
(function () {
document.write("it also works");
})();
There no difference between the two , The opening brace serves as a syntactic hint to tell the parser that what follows is a function expression instead of a function declaration.
for more http://jsperf.com/self-invoking-function
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