21. Prototype Chain


#1

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.


#2

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:


#3

Thanks for the clarification :slight_smile:


#4

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