shorthand syntax function in objects javascript 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"