Skip to content

Instantly share code, notes, and snippets.

@anein
Created December 19, 2016 01:48
Show Gist options
  • Save anein/911ecb4c82c763b6de8f3386a3075eff to your computer and use it in GitHub Desktop.
Save anein/911ecb4c82c763b6de8f3386a3075eff to your computer and use it in GitHub Desktop.
IIFE variations
// 1
( function IIFE(){/*...*/} )();
// 2
( function IIFE(){/*...*/}() );
// 3
( function(){/*...*/} )();
// 4
( function IIFE( global ){/*...*/} )( window );
// 5
( function IIFE( undefined ){
var a;
if( a === undefined ){/*...*/}
} )();
// 6
( function( def ){
def( window );
} )( function def( global ){/*...*/} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment