Illegal use of reserved word 'class'
immediately ran into an error when trying to create a class in a script file. I want to use a class with a constructor instead of defining objects individually. This code works. I can access the properties and the method just fine:
const mockupSize = {
w:595.2756,
h:841.8898,
compare: function(testW, testH){
return (testH==this.h)&&(testW==this.w);
}
}but this code threw an "Illegal use of reserved word 'class'" error. What am I missing? Am I not allowed to create a class?
class StdBoardSize {
constructor(width, height){
this.h = height;
this.w = width;
}
compare(testW, testH){
return (testH==this.h)&&(testW==this.w);
}
}
const mockupSize = new StdBoardSize(595.2756,841.8898);
