Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6112

VS code doesn't support optional chaining in JavaScript (Ubuntu)

$
0
0

I try to run this simple code in VS Code on Ubuntu:

let user = {};console.log(user?.name);

But I get: "SyntaxError: Unexpected token ." refering to the dot after the question mark.

How can I fix this?

I ran the code in Firefox and also in the terminal. Both works fine. So I assume it's an VS Code problem. My node.js version is v20.16. btw. I installed VS Code and some extensions just one week ago. So I don't think it's related to outdated versions.

What I already did:

  • installed the JavaScript and TypeScript Nightly extension
  • updated node.js
  • in settings I enabled "javascript.suggest.autoImports"
  • in settings I enabled "javascript.validate.enable"

Viewing all articles
Browse latest Browse all 6112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>