Creating objects using JavaScript class syntax. keep getting a syntax error for some reason. Any help would be appreciated.
//using javascript class syntax to create and manage numerous objects at the same time.
class player {
//creates properties of the object we can plug in
constructor(name,age,online,onlineStatus) {
this.name = name;
this.age = age;
this.online = online;
}
//creates a method we can use for these objects that do special tasks
onlineStatus() {
if (this.online === true) {console.log(`${this.name} is online at the moment`)}
else {console.log(`${this.name} is offline at the moment``)}
}
}
//creating a new object from scratch using javascript class syntax. You can create objects cery fast this way.
var player1 = new player('Chris', '23', true);
//calling the method on our object
player1.onlineStatus();