Skip to content

Instantly share code, notes, and snippets.

@lolptdr
Created November 19, 2014 23:07
Show Gist options
  • Save lolptdr/1b03ee0049298cfe15fb to your computer and use it in GitHub Desktop.
Save lolptdr/1b03ee0049298cfe15fb to your computer and use it in GitHub Desktop.
short circuit examples - gilbert
// Short-circuit examples
var one = 10 || 20
console.log("1.", one)
var two = false || 30
console.log("2.", two)
var three = true || 40 || 50
console.log("3.", three)
var four = true || auagoduoracehuroeu
console.log("4.", four)
var five = { random: 'stuff' } || icaeougude
console.log("5.", five)
// This throws an error:
// var six = false || uaoeuo || true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment