es6-interactive-guide
es6-interactive-guide copied to clipboard
Concise methods example
In the concise methods section the explanation provided is:
"In object literals and classes we can condense
render: function () {}
torender()
"
And the example is the following:
const foo = function () {
return "foo"
};
const a = "a";
const obj = {foo, a};
console.log(obj.foo());
console.log(obj.a);
This doesn't showcase at all what the description says. I think a better example would be something like:
const obj = {
foo() {
return "a";
}
};
console.log(obj.foo());
With the console output:
"a"
Would be happy to submit a PR if you think that aligns with the goals of this project! Great resource by the way!