Skip to content

Instantly share code, notes, and snippets.

@dwickstrom
Last active January 1, 2018 12:03
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 dwickstrom/f42126e51c9e516a7263842bfc31252b to your computer and use it in GitHub Desktop.
Save dwickstrom/f42126e51c9e516a7263842bfc31252b to your computer and use it in GitHub Desktop.
ternary conditional formatting
const foo = a =>
a === 1 ? 'one'
: a === 2 ? 'two'
: a === 3 ? 'three'
: /* else */ 'more'
const hello = foo => bar =>
foo < bar ? foo * 2
: foo > bar ? bar * 2
: /* else */ 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment