Understand the Prototype Chain does not pass test

Tell us what’s happening:
Does not pass “Your code should show that Object.prototype is the prototype of Dog.prototype” test. Tried to add console.log, but it did not help.

Your code so far


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

let beagle = new Dog("Snoopy");

Dog.prototype.isPrototypeOf(beagle);  // => true

// Fix the code below so that it evaluates to true
console.log(Object.isPrototypeOf(Dog.prototype));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain

try this:


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

let beagle = new Dog("Snoopy");

Dog.prototype.isPrototypeOf(beagle);  // => true

Object.prototype.isPrototypeOf(Dog.prototype);

The exercise is to show Object.prototype as a prototype of Dog.prototype.
In your code you have not specified the prototype of Object, instead you pass the entire Object to isPrototypeOf(). Try using ‘Object.prototype’!

I understand your thinking by using console.log, however it is not relevant to solving the exercise as you’re not literally supposed to show it in the console. :wink:

Thank you, that helped