Object.setPrototypeOfintermediate// Set the prototype of an object
const animal = { breathe() { return true } }
const dog = {}
Object.setPrototypeOf(dog, animal)
dog.breathe() // β trueUse Object.setPrototypeOf() to dynamically change an object's prototype, though creating objects with the correct prototype upfront is preferred.
After calling Object.setPrototypeOf(), use Object.getPrototypeOf() to confirm the prototype was correctly set.
Challenge: Set the prototype and verify it with Object.getPrototypeOf().