Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to make arrow functions as object methods

var chopper = {
    owner: 'Zed',
    getOwner: function() {
        return this.owner;
    }
};

// or

var chopper = {
    owner: 'Zed',
    getOwner() {
        return this.owner;
    }
};
 
PREVIOUS NEXT
Tagged: #arrow #functions #object #methods
ADD COMMENT
Topic
Name
2+7 =