Skip to content
All lessons

Tech Insights· dorendev.hashnode.dev

When To Use the ?? And || In JavaScript — The ?? (nullish coalescing) and || (logical OR) operators in JavaScript provide default values when the left-hand side expression is not provided. The ?? operator only checks for null and undefined, allowing other

falsy values like 0, false, or an empty string to remain. The || operator checks for all falsy values. The ?? operator is particularly useful for APIs, optional parameters, or dynamic data that may not always be defined.

Shared by

Read on dorendev.hashnode.dev

Book a call

Lessons like this one
shape how we build.

Tell us what you’re building. In one call, we’ll show you how our team would approach it.

Tell us what you’re building, and we’ll show you how we’d approach it.

Still prefer the good old email? Contact us