multi ternary operator condition js code example
Example 1: js ternary else if multi
var foo = (
bar === 'a' ? 1 : // if
bar === 'b' ? 2 : // else if
bar === 'c' ? 3 : // else if
null // else
);
Example 2: multiple ternary operator javascript
var icon = (area == 1) ? icon1 : (area == 2) ? icon2 : icon0;