Pls help me to understand

Tell us what’s happening:
Describe your issue in detail here.
i dont understand how this"console.log(bicycle.gear)"code is returning 3 as the same as this code "bicycle.setGear(3);"cause i expected it to return 2 not 3

  **Your code so far**
// Only change code below this line
const bicycle = {
gear: 2,
setGear(newGear) {
  this.gear = newGear;
}
};
// Only change code above this line
bicycle.setGear(3);
console.log(bicycle.gear);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Write Concise Declarative Functions with ES6

Link to the challenge:

this one is a method on the bycicle object that changes the gear property

so bycicle.gear will become equal to the argument passed in to bicycle.setGear()

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