javascript - What is difference between these two self invoking functions -
this question has answer here:
both of these functions below self-invoking functions. can explain me difference between these two? i've looked around lot of places. i've not been able find anything.
first type
(function(){ console.log('hello world'); }());
second type
(function(){ console.log('hello world'); })();
they're same. they're 2 different similar ways force js engine correctly interpret function expression.
another way example
+function(){ console.log('hello world'); }()
the accepted convention put parenthesis around function expression :
(function(){ console.log('hello world'); })();
Comments
Post a Comment