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
}
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
}
Share
Improve this question
edited Jul 26, 2017 at 5:47
Junaid
1,3003 gold badges15 silver badges35 bronze badges
asked Jul 26, 2017 at 1:50
Vinay MadanVinay Madan
1531 gold badge1 silver badge6 bronze badges
2 Answers
Reset to default 12Afaik, 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