I am getting this error while trying a write a basic JS in Visual Studio Code.
Already tried changing the settings.json ( $workspace/.vscode/settings.json ) but it doesn't work.
{
"javascript.validate.enable": false
}
About the App Visual Studio Code is a cross platform code editor written in TypeScript based on Code OSS with support for extensions and a wide range of programming languages.
Afaik, You can't define static const within the class declaration. you can try something like this
const MAX_WIDTH = 8.5;
class Books {
get MAX_WIDTH() {
return MAX_WIDTH;
}
}
let myBooks = new Books()
alert(myBooks.MAX_WIDTH);
Are you sure it is right javascript syntax?
class Books {
static const MAX_WIDTH = 8.5;
}
So far as i know, it's not possible to define static property even in ES2015.
You may try some way else, for example:
class Books {
static get MAX_WIDTH() {
return 8.5;
}
}
console.log(Books.MAX_WIDTH);//8.5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With