What does the logical nullish assignment operator (??=) do?

JavaScript Associate Easy

JavaScript Associate — Easy

What does the logical nullish assignment operator (??=) do?

Key points

  • ??= only assigns if variable is null or undefined
  • Does not assign for any other falsy values
  • Prevents unintentional overwriting of existing values

Ready to go further?

Related questions