Need urgent help


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

//Why does this not work?


#2

@bohjo
To Instantiate the Person object class constructor
you will have to use the new keyword/operator
like

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

#3

Thank you for the fast reply leonhard!