function as follows:
const person = {With ES6, You can remove the
name: "Taylor",
sayHello: function() {
return `Hello! My name is ${this.name}.`;
}
};
function keyword and colon altogether when defining functions in objects. Here's an example of this syntax:
const person = {
name: "Taylor",
sayHello() {
return `Hello! My name is ${this.name}.`;
}
};
setGear inside the object bicycle to use the shorthand syntax described above.
function expression was not used.');
- text: setGear is a declarative function.
testString: assert(typeof bicycle.setGear === 'function' && getUserInput('index').match(/setGear\s*\(.+\)\s*\{/), 'setGear is a declarative function.');
- text: bicycle.setGear(48) changes the gear value to 48.
testString: assert((new bicycle.setGear(48)).gear === 48, 'bicycle.setGear(48) changes the gear value to 48.');
```