Error: Cannot read property 'name' of undefined


#1


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


TypeError: Cannot read property 'name' of undefined


var Person = function(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.name + " species is " + sally.species + " and she is " + sally.age);
console.log(holden.name + " species is " + holden.species + " and he is " + holden.age);


#2

HI these line

var sally = Person("Sally Bowles", 39);
var holden = Person("Holden Caulfield", 16);

it's missing the key new before Person


#4

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