Nullish coalescing assignment operator (??=) in NodeJS

The error means your version of Node does not yet have support for the ??= operator.

Check out the versions which support it on node.green:

enter image description here


It's possible for node version v15.14+.

The rewrite for something like

a.greeting ??= "hello"

in node <v15.14 is:

a.greeting = a?.greeting ?? 'hello'

Maybe it does help someone :]


The node version you are using doesn't support the nullish coalescing assignment operator.