Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript Object Methods

const person = {
    name: 'Sam',
    age: 30,
    // using function as a value
    greet: function() { console.log('hello') }
}

person.greet(); // hello
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #JavaScript #Object #Methods
ADD COMMENT
Topic
Name
5+1 =