Nibbles: nullish coalescing

Andrew Bone - Aug 1 '20 - - Dev Community

The nullish coalescing operator is a logical operator similar to the logical OR operator. The operator will return what is on it's right hand side when the left hand side is nullish, (null or undefined).

Syntax

const output = leftExpr ?? rightExpr;
Enter fullscreen mode Exit fullscreen mode

Example

Support

Current support is all major browsers except IE.

Further reading:

nullish coalescing operator
caniuse
logical OR operator

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player