const person = {
fullName: function () {
return this.firstName + " " + this.lastName;
},
};
const person1 = {
firstName: "Anand",
lastName: "Chaudhary",
};
const person2 = {
firstName: "Rahul",
lastName: "Chaudhary",
};
const fullName=person.fullName.call(person2);
console.log(fullName)
const person = {
fullName: function (location, exp) {
return this.firstName + " " + this.lastName + " " + location + " " + exp;
},
};
const person1 = {
firstName: "Anand",
lastName: "Chaudhary",
};
const person2 = {
firstName: "Rahul",
lastName: "Chaudhary",
};
const fullName = person.fullName.call(person1, "Gurugaon", "2 years");
console.log(fullName);
0 Comments