23.... What is the problem here?


#1

I wrote my code but the species type is still undefined, what is wrong.

function Person(name,age) {
this.name = name;
this.age = age;
this.species = "Homo Sapiens";
}

var sally = ("Sally Bowles", 39 );
var holden = ("Holden Caulfeild", 16 );
console.log("sally's species is " + sally.species + " and she is " + 39 );
console.log("holden's species is " + holden.species + " and he is " + 16 );


#2

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

That's going to assign 39 to sally, beacuse that's what the expression ("Sally Bowles", 39) evaluates to, which you then used = to make sally refer to.

Reconsider what you were trying to do and how it's meant to be done.


#3

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