More Options


#1


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


TypeError: Cannot read property 'species' of undefined


function Person(name,age) {
  this.name = name;
  this.age = age;
  this.species = "Homo Sapiens";
}

var sally = Person("Sally Bowles", 39);
var holden =  Person("Holden Cauflield", 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

This is because Sally and Holden aren't just a person they are a new person. Try that and that should solve your issue.


#3

@bibleman13 Thanks for your response but it is giving the same error.


#4

ok now it worked perfectly i forgot the #New key word. Thanks again.


#5

No problem man glad to have helped! :smiley:


#6

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