21/30 - Up the Food-I-Mean-Prototype Chain


#1

@leonhard_wettengmx_n

Hii Can you please explain me how to print boolean value here in this code:

// 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(myEmperor.saying); // should print "Waddle waddle"
console.log(myEmperor.numLegs); // should print 2
console.log( ); // should print true


#2

console.log( myEmperor.name !== "Chopper" ); // should print true


#3

I believe it should be below
console.log(myEmperor.isAlive); // should print true


#11