es6 javascript method inside object 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"