I saw some code that looked like this, but this client does not like "style" comments:
let value = x === y
? a.something
: x === w
? a.other
: y === z
? b.that
: c
Yes, you can tell what it does, but it takes a few moments.
They could have done this:
let value = c;
if (x === y) {
value = a.something;
} else if (x === w) {
value = a.other;
} else if (y === z) {
value = b.that;
}
These guys are really into functional programming, and the ternary operator is more functional (in the "functional programming" sense), so you end up with stuff like that.