Optional Chaining is a new JavaScript API that will make developers' lives easier :D. Optional Chaining is currently at Stage 3, and soon enough wi...
For further actions, you may consider blocking this person and/or reporting abuse
console.log(restaurant.openingHours[tue] ? .open);
on saving I get a gap between . and ? as seen above.
The on console this is the error.
Uncaught SyntaxError: Unexpected token '.'
Try removing the spaces between
.
and?
."eslint.autoFixOnSave": true,
the above code seems to be deprecated.
kindly assist.
Can you disable ESLint? ESLint may be causing the error.
The error occurs when I save the file.
Thank you!
If you use React with CRA and upgrade to CRA 3.3.0 you just have to add the .vscode./settings.json to your repository.
where can I find .babelrc & .eslintrc files ?
Inside node-modules folder, I can see lot of files with the same name.
They should be at your project's top level.
Very helpful this config of VS Code, thanks!
what is the difference between x?.y?.z || 24 and x?.y?.z ?? 24
The main difference between the Logical OR (
||
), and Nullish Coalescing Operator (??
) is the that (??
) returns its right-hand side operand when its left-hand side operand is only null or undefined and doesn't respect the other falsy value (e.g. 0, false, '').See the outputs:
For sure, the behaviour for
??
will be exactly the same as||
if z is undefiend or its value is null