Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

es6 method definition syntax

const obj = {
  foo() {
    return 'bar';
  }
};

console.log(obj.foo());
// expected output: "bar"
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #method #definition #syntax
ADD COMMENT
Topic
Name
5+9 =