javascript - Visual Studio Code 'const' can only be used in a .ts file -


i getting error while trying write basic js in visual studio code.

already tried changing settings.json ( $workspace/.vscode/settings.json ) doesn't work.

  {      "javascript.validate.enable": false   } 

enter image description here

are sure right javascript syntax?

class books {     static const max_width = 8.5; } 

so far know, it's not possible define static property in es2015.

you may try way else, example:

class books {     static max_width() {         return 8.5;     } }  console.log(books.max_width);//8.5 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -