Make Your Own Method


#1

Hey guys, so I've been fiddling with this for a while but it's still not working. It continues to say:

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

I'm not sure why they are asking that, because it is in fact, set to 8. Any solutions? Thanks!

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
rectangle.setHeight(6);
rectangle.setWidth(8);
}
};


#2

Move these two up to close the setHeight method, for one of them, and the setWidth method for the other. They will both get a semi-colon.


#3

That solved the problem, thanks!