1function example(…) {
2 return condition1 ? value1
3 : condition2 ? value2
4 : condition3 ? value3
5 : value4;
6}
7
8// Equivalent to:
9
10function example(…) {
11 if (condition1) { return value1; }
12 else if (condition2) { return value2; }
13 else if (condition3) { return value3; }
14 else { return value4; }
15}
16