What is a JavaScript call() Method?
Answers
Answered by
0
_______________________________
________________________________
What is a JavaScript call() Method?
»»» The call() method in javascript is the predefined method.
»»» It can be used to invoke (call) a method with an owner object as a parameter.
»»» With call(), an object can use a method belonging to another object.
_________________________________
:-
var person = {
fullName: function() {
return this.firstName + " " + this.lastName;
}
}
var person1 = {
firstName:"John",
lastName: "Doe"
}
var person2 = {
firstName:"Mary",
lastName: "Doe"
}
person.fullName.call(person1); // Will return "John Doe"
___________________________________
HOPE IT HELPS YOU❤
Similar questions