javascript - What is difference between these two self invoking functions -


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

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -