Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Javascript Class Methods

// constructor function
function Person (name) {

   // assigning  parameter values to the calling object
    this.name = name;

    // defining method
    this.greet = function () {
        return ('Hello' + ' ' + this.name);
    }
}
 
PREVIOUS NEXT
Tagged: #Javascript #Class #Methods
ADD COMMENT
Topic
Name
5+4 =