I'm trying to assign housePrototype as the prototype of House object, and followed up with this error
Object.assign(House.prototype, this.housePrototype); ^ TypeError: Cannot convert undefined or null to object
What am I doing wrong?
const House = {
name: 'houseObject',
readLocation: (location)=>{
console.log(`house is located at ${location}`)
}
}
const housePrototype = {
readLocation: (location) => {
console.log(`house prototype is located at ${location}`)
}
}
Object.assign(House.prototype, housePrototype)
House.readLocation('Malabe');
console.log(House);