Penguins, Properties and the Prototype


#1


https://www.codecademy.com/courses/objects-ii/3/5?curriculum_id=506324b3a7dffd00020bf661#


The error I receive is : Oops, Try Again. Make sure to log the number of legs emperor has.

The thing is I am fairly certain the code is correct. When I open my browser's JavaScript console and copy and run my code the correct number, 2, is logged to the browser. If you see something in my code, please tell me what I am doing wrong. Otherwise I guess it's just a bug.


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("Jank");
console.log(emperor.numLegs);

#2

Your code does not give any error, refresh the page,Maybe it help!


#3

i got the same code but this error keeps popping out "Oops, try again. Make sure to log the number of legs emperor has!"


#4

I got the same error. Refreshing the page solved the problem.


#5

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