Skip to main content

--description--

Just like people inherit genes from their parents, an object inherits its prototype directly from the constructor function that created it. For example, here the Bird constructor creates the duck object:

function Bird(name) {
this.name = name;
}

let duck = new Bird("Donald");

duck inherits its prototype from the Bird constructor function. You can show this relationship with the isPrototypeOf method:

Bird.prototype.isPrototypeOf(duck);

This would return true.

--instructions--

Use isPrototypeOf to check the prototype of beagle.

--hints--

You should show that Dog.prototype is the prototype of beagle

assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(__helpers.removeJSComments(code)));

--seed--

--seed-contents--

function Dog(name) {
this.name = name;
}

let beagle = new Dog("Snoopy");

// Only change code below this line

--solutions--

function Dog(name) {
this.name = name;
}
let beagle = new Dog("Snoopy");
Dog.prototype.isPrototypeOf(beagle);