21 . Up the Food-I-mean-Prototype Chain


#1

I need assistance with this exercise please...I dont want to copy other people's code.
https://www.codecademy.com/en/courses/objects-ii/3/6?curriculum_id=506324b3a7dffd00020bf661#

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");{
    this.numLegs = 2
    
    }

console.log(  ); // should print "Waddle waddle"
console.log(  ); // should print 2
console.log(  ); // should print true

#2

Hi this line

console.log(  ); // should print "Waddle waddle"

you should print "Waddle waddle" like that by putting myEmperor.saying in the console.log()
you do the same for the others

console.log(  ); // should print 2
console.log(  ); // should print true

#3

AWeSome I got it ! Thanks a billion!

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


#4

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