Logical nullish assignment (??=) gives an error in Visual Studio Code

Logical nullish assignment is giving SyntaxError: Unexpected token '??=' in the Visual Studio Code. Is there any solution for this error?

I am trying this code;

const a = { duration: 50 };

a.duration ??= 10;
console.log(a.duration);
// expected output: 50

a.speed ??= 25;
console.log(a.speed);
// expected output: 25

3 thoughts on “Logical nullish assignment (??=) gives an error in Visual Studio Code”

Leave a Comment