DEV Community

Cover image for Nibbles: nullish coalescing
Andrew Bone
Andrew Bone

Posted on

1 1

Nibbles: nullish coalescing

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

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series πŸ‘€

Watch the Youtube series

πŸ‘‹ Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay