What does the nullish coalescing operator (??) return?

JavaScript Developer Medium

JavaScript Developer — Medium

What does the nullish coalescing operator (??) return?

Key points

  • Nullish coalescing operator (??) is used to provide a default value for variables that may be null or undefined.
  • It differs from logical OR (||) which considers all falsy values, not just null or undefined.
  • This operator helps in handling default values more precisely in JavaScript.

Ready to go further?

Related questions