21. Prototype Chain


console.log(myEmperor.saying); // should print "Waddle waddle"
console.log(Penguin.numLegs); // should print 2
console.log(Animal.isAlive); // should print true

Is something wrong here? Only "Waddle waddle" get's printed, but it says "Oops you didn't print 2 and true"

Replace this line with your code.


You should call the numLegs and isAlive methods using myEmporer as well, like this:

console.log(myEmperor.saying); // should print "Waddle waddle"
console.log(myEmperor.numLegs); // should print 2
console.log(myEmperor.isAlive); // should print true

You can't call a method using a class, you have to use an object. :slight_smile:


Thanks for the clarification :slight_smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.