I have created one constructor function named House in JS.
function House(color, floor, location){
this.color = color;
this.floor = floor;
this.location = location;
}
Using this prototype I have created two more objects named myHouse and myOldHouse.
var myHouse = new House('brick red', '1st floor', 'saltlake');
var myOldHouse = new House('Yellow', '2st floor', 'Koikhali');
Then I have added one new method called address to the myHouse object.
myHouse.address = function(address){
this.address = address;
console.log('My address is '+this.address);
}
Now I am want to add this method to myOldHouse object as well using the call function.
myHouse.address.call(myOldHouse, '2G');
But when I am calling myOldHouse.address(), it is showing error.