I have a Syntax error and I'm not sure how to fix it, can someone please help?


I don't understand why this error is showing up:

"Oops, try again.Make sure to set rectangle's width to 8!"

This is what my code looks like and its the same as some others that I have seen on here.

var rectangle = new Object();
rectangle.height = 3;
rectangle.width = 4;
// here is our method to set the height
rectangle.setHeight = function (newHeight) {
this.height = newHeight;
// help by finishing this method
rectangle.setWidth = function (newWidth) {
this.width = newWidth;
// here change the width to 8 and height to 6 using our new methods

I have tried to delete it and refresh the screen and then paste it back in and I still get the error and in the top right black box I just get the number "8".

Can someone please help me understand why this is wrong? Thanks ahead of time.


Oh I got it it's just a simple mistake were you just had a syntax here:

Where it's suppose to me this.width = new width();

For the height to the same thing. Just fix that and tell me if it dose t work. I'm sorry if this is not organized. Typing in codecademy using a phone is a pain.

You forgot t


Hey @daviddaniels09,

Your problem is here:

You aren't supposed to include the equal signs between the (6)/(8) and setHeight/setWidth.:smiley:


I appreciate that @ragezapper.