23. More Options


#1

https://www.codecademy.com/en/courses/spencer-sandbox/3/4?curriculum_id=506324b3a7dffd00020bf661#

I'm not quite sure what I'm doing wrong, here is the error code I am recieving:

Oops, try again. Your code threw the following error when sally's name was checked: TypeError: Cannot read property 'name' of undefined

Here is my code:

function Person(name, age) {
    this.name = name;
    this.age = age;
    this.species = "Homo Sapiens";
};
var sally = Person("Sally Bowles", 39);
var holden = Person("Holden Caulfield", 16);
console.log("sally's species is " + sally.species + " and she is " + sally.age);
console.log("holden's species is " + holden.species + " and he is " + holden.age);

#2

Nevermind... I just realized i didn't use new when defining sally and/or holden...


#3

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