23/33 More Options I'm so stuck

Excuse me could someone please help me with this I’m really stuck. I did the function and it tells me there is a problem with your syntax. I’ve looked at some of the others but it doesn’t work, so could someone please help me badly please… Thank you so much :slightly_smiling:

Can you please post your code?

Yes I am having the same problem

This is my code:
function Person(name,age) {
this.name = name;
this.age = age;
this.species = “■■■■ Sapiens”;
};

var sally = new Person() {
this.name = “Sally Bowles”;
this.age = 39;
};
var holden = new Person() {
this.name = “Holden Caufield”;
this.age = 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);

1 Like

here’s my code… I don’t know if I’ve done it right.
function Person(name,age) {
this.name = name;
this.age = age;
this.species = “■■■■ Sapiens”;
}

var sally = new Person {
this.name = “Sally Bowles”;
this.age = 39;
};
var holden = new Person {
this.name = “Holden Caulfield”;
this.age = 16;
};
console.log("sally’s species is " + sally.species + " and she is " + );
console.log("holden’s species is " + holden.species + " and he is " + );

The problems are:

and

You need to put the name and age value inside the parenthesis. like this:

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

Hope this hepls

3 Likes

@firefly045 you also need to add the age of sally and holden in your console.log like this:

 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);
1 Like

Thank you gracie017 :relaxed:

Welcome, Happy Coding! :slight_smile:

You too. :slightly_smiling:

Thank You!!!:slightly_smiling:

My pleasure and happy coding :slight_smile:

Sorry but what is wrong here?!

function Rectangle(height, width) {
this.height = height;
this.width = width;
this.calcArea = function() {
return this.height * this.width;
};
// put our perimeter function here!
function calcPerimeter(height, width) {
this.height = height;
this.width = width;
this.calcPerimeter = function() {
return 2 * height + 2 * width
};

var rex = new Rectangle(7,3);
var area = rex.calcArea(7,3);
var perimeter = rex.calcPerimeter(7,3);

Here try this.
function Rectangle(height, width) {
this.height = height;
this.width = width;
this.calcArea = function() {
return this.height * this.width;
};
// put our perimeter function here!
this.calcPerimeter = function() {
return 2 * this.height + 2 * this.width;
};
} // <— close it here

var rex = new Rectangle(7,3);
var area = rex.calcArea();
var perimeter = rex.calcPerimeter();
console.log(rex, area, perimeter);

Thank you! You’re really good at this!:relaxed:

What specific lesson?

All Good :slightly_smiling:

For which one exactly?

Soory, its for @lachlan2003. He/she’s asking for a help then i asked what specific lesson. hehehe

that’s alright. hehehe