It is normally known as the “ternary operator” and is a shortened form of the if...else expression:
var a = 42;
var b = (a > 41) ? "hello" : "world";
// if (a > 41) {
// b = "hello";
// }
// else {
// b = "world";
// } Dec 03, 20251 min read
It is normally known as the “ternary operator” and is a shortened form of the if...else expression:
var a = 42;
var b = (a > 41) ? "hello" : "world";
// if (a > 41) {
// b = "hello";
// }
// else {
// b = "world";
// }