18/33 I don't see what is wrong with my code


#1


I'm stuck at 18/33 of JS.
Error it calls upon me is: Oops, try again. Make sure to set rectangle's width to 8!
As far as I am aware nothing is wrong with my coding. Might be on my end by just looking at the coding too much. Any help is appreciated! :slight_smile:


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.setWidth = 8;
rectangle.setHeight = 6;


#2

So close!
Instead of: rectangle.setWidth = 8;
Try this: rectangle.setWidth(8);

That's how you correctly use the functions you have created. Do this for both the height and width and your good to go.

If that solved it please make my reply the solution.


#3

Awesome! Thank you so much! :smiley:


#4

You are most welcome.


#5

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