19.) Black (and White) Penguin Magic. Create New Penguin


#1

In fact, @kyleaw, I am so into it I have a question :stuck_out_tongue: So, basically, my whole code is below and the error I am getting is as follows: Make sure to create a new Penguin instance called penguin!

Link to lesson: https://www.codecademy.com/courses/objects-ii/3/4?curriculum_id=506324b3a7dffd00020bf661

However, it is confusing because I believe I already have that worked out? At least I don't know to many more ways to have new Penquin in the existing code haha. So have I just missed something simple or do I have more to work on? ugh xD

// the original Animal class and sayName method
function Animal(name, numLegs) {
    this.name = name;
    this.numLegs = numLegs;
}
Animal.prototype.sayName = function() {
    console.log("Hi my name is " + this.name);
};

// define a Penguin class
function Penguin(name) {
    this.name = name;
    this.numLegs = 2;
}
Penguin.prototype = new Animal();


// set its prototype to be a new instance of Animal
Penguin.prototype = new Animal();
var penguin = new Penquin("brad");
penguin.sayName();

#2

Alright I'm on it :slight_smile:

Edit:
Cmon, did you read the error message :stuck_out_tongue:

You used a q instead of g


#3

sigh I want to hid now...I misspelled penguin ugh lol This is what I get for staying up later at night trying to work stuff out xD Excuse me while I go scream like a maniac outside.... I must have spent at least a couple of hours looking at that x(


#4

sigh
i know i see you telling people that they have typos in their code all the time.
just goes to show that it happens to the best of us :stuck_out_tongue:

thanks for thisi visual

you're still amazingly cool in my book :sunglasses:

i'm laughing like a five yr old and i can't stop.
you'll get em next time.


#5

Correction, I tell everyone that they have typos and that is common because 50% of my topics on Codecademy is me embarissing myself by grammar errors or spelling mistakes haha that number might be rising x(

That is dangerous to your health girl just don't turn blue or start rolling on the floor :stuck_out_tongue: And you changed your profile pic at the same time you have talent beyond your years @kyleaw hehe


#6

roflcopter

okay well glad we solved this, i love helping you. see ya on the forums :slight_smile:

everything you say is funny you have to stop

@bibleman13 oh wow


#7

Well well well. Idk it looks pretty good you should keep it that way :sunglasses: Apparently, I am too involved in your codecademy life so I will go hid somewhere so you can have more friends :stuck_out_tongue:


#8

A post was split to a new topic: 19. black and white penguin magic


#9