Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript Function apply()

const person = {
  fullName: function() {
    return this.firstName + " " + this.lastName;
  }
}

const person1 = {
  firstName: "Mary",
  lastName: "Doe"
}

// This will return "Mary Doe":
person.fullName.apply(person1);
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #JavaScript #Function
ADD COMMENT
Topic
Name
2+4 =