23. More Options


#1


I keep getting this error when I use this code: TypeError: Unable to get property 'species' of undefined or null reference


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

should be,

var sally = new Person("Sally Bowles", 39);

Same goes for holden.