ES6 - Write Concise Declarative Functions with ES6

Tell us what’s happening:
Console says missing semicolon but that can’t be the issue, please help

Your code so far

// Only change code below this line
const bicycle = {
  gear: 2,
setGear () {
  newGear = ${this.gear};
}
// Only change code above this line
bicycle.setGear(3);
console.log(bicycle.gear);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Challenge: ES6 - Write Concise Declarative Functions with ES6

Link to the challenge:

You changed more of the function then you should have. First the function should have a parameter, but you removed that. Second newGear isnt going to work the way you have because you never defined it with let or const. However, it for this challenge it shouldnt be used this way anyway. Third im not sure why you are trying to use template literals, but your syntax is off on that as well.

I would reset the lesson, and the only thing you should be doing is using the shorthand to make the function like the example. Nothing inside the actual function should change

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.