URL: https://www.progressiverobot.com/js-immediately-invoked-function-expression/

Protect your global environment from being polluted by your code with immediately-invoked function expressions (IIFE). Code within an IIFE is within its own lexical scope:

				
					
(function() {

  // your stuff here

})();

				
			

Passing-In Variables

immediately-invoked function illustration for: Passing-In Variables

You can pass variables in the IIFE's scope with something like this:

				
					
(function($) {

  // $ == jQuery;

})(jQuery);