The above does not provide context for this problem.
I’m pursuing this path because they say if you spend large amounts of time on learning syntax, you will never forget…instead of just looking at the answers!
var person = {
name: 'JP',
age: 102,
weekendAlarm: 'No alarms needed',
weekAlarm: 'Alarm set at 7AM',
hobbies: ['boardgames'],
sayHello: () => { ///Do I need to move this to the bottom of the list?
return `Hello, my name is ${this.name}`
sayGoodbye(){return 'Goodbye!'}
};
Responding to your question, the comma is there because there is another key following the object. I have used backticks like you said but still the error says unexpected token.
I’m trying to figure out why it says unexpected token.
Any help would be appreciated - as I’m learning to error read for this example.
how to declare a method, both the es5 and es6 way are displayed on this page.
you forgot a } to close your sayHello method.
There are two ways which are common to use curly brackets:
method {
}
or:
method
{
}
i really recommend you to start using them. Build in some good habits. There is a reason these two approaches are the most common, they reduce the change of making mistakes with missing curly brackets. And if you do miss them, they are easier to find. If you handle a single standard, that is.