What does the nullish coalescing operator `??` return?

JavaScript Associate Medium

JavaScript Associate — Medium

What does the nullish coalescing operator `??` return?

Key points

  • `??` returns the right operand when the left operand is null or undefined
  • It helps in providing default values in JavaScript
  • It does not consider other falsy values like 0 or an empty string

Ready to go further?

Related questions