Link Search Menu Expand Document

Write Concise Declarative Functions with ES6

Summary

  • The function keyword is not needed to define a function in ES6.

Final Code

// 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);