closures - What is the purpose of a self executing function in javascript? -


in javascript, when want use this:

(function(){     //bunch of code... })(); 

over this:

//bunch of code... 

its variable scoping. variables declared in self executing function are, default, available code within self executing function. allows code written without concern of how variables named in other blocks of javascript code.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - IIFE: var vs this - is there any difference? -

r - Grow a ffdf data frame on disk gradually -