javascript inline if multiple code example
Example 1: one line if else if statement javascript
var variable = (condition) ? (true block) : ((condition2) ? (true block2) : (else block2))
Example 2: The conditional (ternary) operator with three condition
String year = credits < 30 ? "freshman" : credits <= 59 ? "sophomore" : credits <= 89 ? "junior" : "senior";