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

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -