If I choose to use the Object.create() method to create an instance instead of using the new keyword, does it mean that the instance won’t get a copy of the own properties in the constructor function?
function Animal() {
this.numLegs = 2
}
Animal.prototype = {
constructor: Animal,
eat: function() {
console.log("nom nom nom");
}
};
let duck = Object.create(Animal.prototype)
let beagle = new Animal
console.log(duck.numLegs) // undefined
console.log(beagle.numLegs) // 2
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36 Edg/94.0.992.31
Challenge: Inherit Behaviors from a Supertype
Link to the challenge: