The logical nullish assignment ??= assigns the value only if the value of the left hand side is either undefined or null.

a.c ??= 1;

If you like to replace any falsy value, like '', 0, false, null, undefined, you could take the logical OR assignment ||=.

a.c ||= 1;
Answer from Nina Scholz on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Nullish_coalescing_assignment
Nullish coalescing assignment (??=) - JavaScript | MDN
The nullish coalescing assignment (??=) operator, also known as the logical nullish assignment operator, only evaluates the right operand and assigns to the left if the left operand is nullish (null or undefined).
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Nullish_coalescing
Nullish coalescing operator (??) - JavaScript | MDN
Nullish coalescing assignment (??=) Optional chaining (?.) Logical OR (||) Default parameters · Was this page helpful to you? Yes · No Learn how to contribute · This page was last modified on ⁨Aug 26, 2025⁩ by MDN contributors.
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › javascript fundamentals
Nullish coalescing operator '??'
The nullish coalescing operator ?? provides a short way to choose the first “defined” value from a list. It’s used to assign default values to variables:
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › nullish-coalescing-assignment-operator-in-javascript
Nullish Coalescing Assignment (??=) Operator in JavaScript - GeeksforGeeks
July 23, 2025 - Only if the value of x is nullish then the value of y will be assigned to x that means if the value of x is null or undefined then the value of y will be assigned to x.
🌐
freeCodeCamp
freecodecamp.org › news › javascript-advanced-operators
Advanced JavaScript Operators – Nullish Coalescing, Optional Chaining, and Destructuring Assignment
January 4, 2024 - When the firstName value is null or undefined, then the value Guest will be assigned to the username variable instead: ... As you can see, you don’t need an if-else statement to check for null or undefined values. The nullish coalescing operator was created as an improved alternative to the OR operator ||.
🌐
Trevor Lasn
trevorlasn.com › blog › javascript-nullish-coalescing-assignment-operator
JavaScript's ??= Operator: Default Values Made Simple
November 5, 2024 - A guide to using ??= in JavaScript to handle null and undefined values elegantly
🌐
GitHub
github.com › microsoft › TypeScript › issues › 48473
Nullish coalescing assignment operator doesn't work correctly with logical operators · Issue #48473 · microsoft/TypeScript
December 20, 2021 - Bug Report Using the nullish coalescing assignment operator ??= on a logical statement which contains a logical operator (&& or ||) fails to narrow the type, even though using the nullish c...
Published   Mar 29, 2022
Find elsewhere
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › csharp › language-reference › operators › null-coalescing-operator
?? and ??= operators - null-coalescing operators - C# reference | Microsoft Learn
The ?? operator doesn't evaluate ... null-coalescing assignment operator ??= assigns the value of its right-hand operand to its left-hand operand only if the left-hand operand evaluates to null....
🌐
Medium
medium.com › @vinaychhabra.dev › nullish-coalescing-assignment-operator-in-javascript-fe55880a5384
Nullish Coalescing Assignment Operator in JavaScript | by Vinay Chhabra | Medium
April 9, 2024 - We’ve previously explored the ... introduced the Nullish Coalescing Assignment Operator (??=), a powerful addition to simplify default value assignments....
🌐
TypeScript
typescriptlang.org › play › 3-7 › syntax-and-messaging › nullish-coalescing.ts.html
TypeScript: Playground Example - Nullish Coalescing
-1; config.active = config.active ?? true; // Current solution config.name = typeof config.name === "string" ? config.name : "(no name)"; config.items = typeof config.items === "number" ? config.items : -1; config.active = typeof config.active === "boolean" ? config.active : true; // Using || operator which could give bad data config.name = config.name || "(no name)"; // does not allow for "" input config.items = config.items || -1; // does not allow for 0 input config.active = config.active || true; // really bad, always true } // You can read more about nullish coalescing in the 3.7 blog post: https://devblogs.microsoft.com/typescript/announcing-typescript-3-7/
🌐
Reddit
reddit.com › r/javascript › why doesn't javascript have a nullish-coalescing-assignment (??=) operator?
r/javascript on Reddit: Why doesn't JavaScript have a nullish-coalescing-assignment (??=) operator?
October 23, 2021 -

So, JavaScript has x ?? y, which favors the right-hand side if the left one is undefined or null.
However, an oddity that's present with this operator is it's assignment-form.
In JavaScript, most operators have an assignment form + has +=, - has -=, heck, even ** the exponential operator has an assignment-form, and you can probably guess what that looks like.

However, ??= is conveniently absent.
This isn't a huge deal, but it makes the language a little inconsistent, along with that, it would make as a small way to remove redundancy from class-constructors:

class Shape {
    constructor(x, y, w, h) {
        this.x = x ?? this.x;
        this.y = y ?? this.y;
        this.w = w ?? this.w;
        this.h = h ?? this.h;
    }
    // Class body...
}

// Could theoretically become...

class Shape {
    counstructor(x, y, w, h) {
        this.x ??= x;
        this.y ??= y;
        this.w ??= w;
        this.h ??= h;
    }
    // Class body....
}

And since small factorizations like this are the reason why even have +=, I pose to you a question identical to that of the one in the title:
Why do you think JavaScript doesn't have a nullish-coalescing assignment operator?

🌐
V8
v8.dev › features › nullish-coalescing
Nullish coalescing · V8
Default assignment inside object ... the assignment. But these strict equality tests for only undefined aren’t always desirable, and an object to perform destructing on isn’t always available. For instance, maybe you want to default on a function’s return values (no object to destructure). Or maybe the function returns null (which is common for DOM APIs). These are the times you want to reach for nullish coalescing...
🌐
University of New Brunswick
cs.unb.ca › ~bremner › teaching › cs2613 › books › mdn › Reference › Operators › Nullish_coalescing_assignment
Nullish coalescing assignment (??=)
The nullish coalescing assignment (??=) operator, also known as the logical nullish assignment operator, only evaluates the right operand and assigns to the left if the left operand is (null or undefined).
🌐
Wikipedia
en.wikipedia.org › wiki › Null_coalescing_operator
Null coalescing operator - Wikipedia
October 31, 2025 - In earlier versions, it could be used via a Babel plugin, and in TypeScript. It evaluates its left-hand operand and, if the result value is not "nullish" (null or undefined), takes that value as its result; otherwise, it evaluates the right-hand operand and takes the resulting value as its result.
🌐
LinkedIn
linkedin.com › pulse › nullish-coalescing-assignment-rolazar-web-developer
Nullish Coalescing Assignment
December 14, 2023 - The nullish coalescing operator can be combined with the assignment operator, so instead of writing JavaScript code this: The nullish coalescing assignment operator can be used like this: First it evaluates myValue.
🌐
Mastering JS
masteringjs.io › tutorials › fundamentals › nullish-coalescing
The Nullish Coalescing Operator ?? in JavaScript - Mastering JS
The nullish coalescing assignment operator is similar to the nullish coalescing operator, just for assignments. Nullish coalescing assignment only assigns the value if the left hand side is nullish. x ??= y is equivalent to x = x ??
🌐
BetterBugs
betterbugs.io › blog › javascript-double-question-mark-nullish-coalescing-operator
What is JavaScript Double Question Mark (??) or the Nullish Coalescing Operator?
Here, the experienceYears property ... coalescing assignment operator “??=” is a powerful solution when you want only the null or undefined values to be considered as falsy....