21-30 Where is the error?


#1

I did everything right but the error occurs: Oops, try again. It looks like you didn't print Waddle waddle

// original classes
function Animal(name, numLegs) {
this.name = name;
this.numLegs = numLegs;
this.isAlive = true;
}
function Penguin(name) {
this.name = name;
this.numLegs = 2;
}
function Emperor(name) {
this.name = name;
this.saying = "Waddle waddle";
}

// set up the prototype chain
Penguin.prototype = new Animal();
Emperor.prototype = new Penguin();

var myEmperor = new Emperor("Jules");

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


#2

Try

console.log(myEmperor.saying);

Does that work? :slight_smile:


#3

thanks, its works ^^


#5

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