Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js ternary else if multi

var foo = (
  bar === 'a' ? 1 : // if 
  bar === 'b' ? 2 : // else if 
  bar === 'c' ? 3 : // else if
  null // else 
);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #ternary #multi
ADD COMMENT
Topic
Name
9+3 =