Objects 23


#1

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 + "years old.");
console.log("holden's species is " + holden.species + " and he is " + " " + holden.age + "years old." );

I can't see what the issue is :confused:


#2

Hi

I am referring to another recent post.

Please look at the replies by Leonhard


#3

var sally = new Person
var holden = new Person

You were very close you just had an unnecessary semicolon and forgot to put the word new before person


#4

Ah right, NEW object being made with the "Person" distinction. ALso, why is the semicolon not needed? Thanks :smile:


#5

To my knowledge there should be a semicolon at the end.