Immediately-invoked function expressions

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

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

(function($) {
  // $ == jQuery;
  Tweet It

🕵 Search Results

🔎 Searching...