Sally and Holden problem


I'm stuck again...

here's my error message

what's wrong now?


... and she is " + sally.age

Ditto, for Holden.


What's wrong here?


You either do it like this:

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

Which is a lot to type.. or you do it like this:

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

This is much shorter :slight_smile:

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

This is your object constructor function to create Person objects. You can think of it as a factory of Person objects. Anytime you want to make a new one, you use the keyword new and the name of the constructor function which is Person in this case. Ex. : var me = new Person(); . You can pass arguments between parenthesis - name and age - these will become object's properties which can be accessed by dot notation like this: sally.age or this: sally["age"] - in both cases this will return 39.


Edit the sentence printed out such that it includes the age of sally and holden respectively.

There is nothing in the instructions about including their names in the output.


Thanks that solved my stuckness


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