More Options


TypeError: Cannot read property 'species' of undefined

function Person(name,age) { = 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);


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


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


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


No problem man glad to have helped! :smiley:


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