Skip to content

Instantly share code, notes, and snippets.

@Ugarz
Last active March 16, 2017 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ugarz/b4efaa063d66c580414d1f2655587c88 to your computer and use it in GitHub Desktop.
Save Ugarz/b4efaa063d66c580414d1f2655587c88 to your computer and use it in GitHub Desktop.
Sum some Design Patterns Technics in Javascript

IIFE

(function () {
   console.log('bonjour')
}) ();

Named IIFE

(showName = function (name) {
    if (name && name === 'toto'){
        console.log('bonjour ', name)
    } else {
        console.log('qui êtes vous ?')
    }
}) ();

You can use Named IIFE further in your code

showName('toto')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment