es6 method syntax code example
Example: es6 method definition syntax
const obj = {
foo() {
return 'bar';
}
};
console.log(obj.foo());
// expected output: "bar"
const obj = {
foo() {
return 'bar';
}
};
console.log(obj.foo());
// expected output: "bar"