20 Penguins, Properties, and the Prototype


#1


Please Help Can't Figure out what's wrong with my code.

it reply's Oops, try again. Make sure to log the number of legs emperor has! 

function Penguin(name) {
    this.name = name;
    this.numLegs = 2;
}

// create your Emperor class here and make it inherit from Penguin
function Emperor(name) {
this.name = name;
};

Emperor.prototype = new Penguin();
// create an "emperor" object and print the number of legs it has
var emperor = new Emperor("xo");

console.log (emperor.numLegs);


#2

There isn't anything wrong, as such, but a couple of minor tweaks may be all that's needed to get accepted.

  1. Remove semi-colon after function Emperor ... }
  2. Try with no white space after log.

Otherwise, try refreshing the page and submit again.


#3

today i try and it doesn't give any error.
thanks


#4

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