es6 object function 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"