Skip to content

Instantly share code, notes, and snippets.

@sonnyp
Last active April 13, 2016 13:18
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 sonnyp/7ee94895b34db31e61a84e3b9802f76f to your computer and use it in GitHub Desktop.
Save sonnyp/7ee94895b34db31e61a84e3b9802f76f to your computer and use it in GitHub Desktop.
JavaScript IIFE for Node.js and browsers
// global will refer to global for Node.js and window for browsers
;(function (global) { // ; in case the file is concatenated with a non ; line ending
'use strict'
// your code
}(typeof global !== 'undefined' ? global : this)) // `this`doesn't refer to global in Node.js module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment