DEV Community

Avinashd
Avinashd

Posted on

Js in bits - 12.2(Nullish Colaescing)

Learning js should be fun. It is fun if it's easy.
I tried my best in writing this, to understand it the easy way.

?? comparison with ||

Looks like ?? and || are same, but why we need ??

Image description

Example:

Image description

Order of precedence matters!!

Image description

Without paranthesis:

Image description

Few Rules:

Image description

Leave y'r thoughts....

Top comments (0)

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️