23/33 More Options I'm so stuck


#1

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:


#2

Can you please post your code?


#3

Yes I am having the same problem


#4

This is my code:
function Person(name,age) {
this.name = name;
this.age = age;
this.species = "Homo 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);


#5

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 = "Homo 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 " + );


#6

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


#7

@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);

#8

Thank you gracie017 :relaxed:


#9

Welcome, Happy Coding! :slightly_smiling:


#10

You too. :slightly_smiling:


#11

Thank You!!!:slightly_smiling:


#12

My pleasure and happy coding :slightly_smiling:


#13

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


#14

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


#15

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


#16

What specific lesson?


#17

All Good :slightly_smiling:


#18

For which one exactly?


#19

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


#20

that's alright. hehehe