• Returns its left-hand side operand (the first thing) of the left-hand side is anything other than null
or undefined
. Returns the right-hand-side operand (the second thing) if the thing on the left is null
or undefined
.
• A quick way to return the value of the thing or something else (the right-hand side) if that thing is null or undefined. Typically used to make a value safe for output, like displaying empty string if the variable in question is null
or undefined
.
• This is why Typescript developers prefer Typescript and strongly typed languages.