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
Try adding this or similar to your
eslintrc.json
file (or wherever you have your eslint options):