Skip to content

Instantly share code, notes, and snippets.

@brycebaril
Created June 15, 2013 06:31
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 brycebaril/e39c125308e069d453fc to your computer and use it in GitHub Desktop.
Save brycebaril/e39c125308e069d453fc to your computer and use it in GitHub Desktop.
function t(a, b) {
return a & b
? "first" : a
? "second" : b
? "third" : "default"
}
console.log(t(true, true))
console.log(t(true, false))
console.log(t(false, true))
console.log(t(false, false))
/* output
first
second
third
default
*/
function tt(a, b) {
return (a && b) ? "first"
: a ? "second"
: b ? "third"
: "default"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment