Skip to content

Instantly share code, notes, and snippets.

@ultim8k
Created June 26, 2013 14:11
Show Gist options
  • Save ultim8k/5867669 to your computer and use it in GitHub Desktop.
Save ultim8k/5867669 to your computer and use it in GitHub Desktop.
Short-circuit evaluation (AKA lazy assignment)
/**
* Short-circuit evaluation AKA lazy assignment
*/
var a;
var b = null;
var c = undefined;
var d = 4;
var e = 'five';
var f = a || b || c || d || e;
console.log(f); // 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment