declarative function code example
Example: Declarative Functions
//Before ES6
const person = {
name: "Taylor",
sayHello: function() {
return `Hello! My name is ${this.name}.`;
}
};
//With ES6,
//You can remove the function keyword and colon altogether
//when defining functions in objects.
const person = {
name: "Taylor",
sayHello() {
return `Hello! My name is ${this.name}.`;
}
};