Example:
var x, y, z;
//...
x > 100 ? y = x : z = x ;
Yes it does work the same although operator precedence is always tricky so I would recommend parenthesis to avoid confusion.
tangentially related..
You can also use || in JavaScript similar to the null coalescing operator ?? in C#
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With