rectangle.setWidth(8); Error


#1


Hi, I'm stuck. What's wrong with this code? I don't see anything!


https://www.codecademy.com/en/courses/spencer-sandbox/2/6?curriculum_id=506324b3a7dffd00020bf661#

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


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

is not the same as this.width


#3

Thanks! That's it. I wonder how I didn't see this!


#4

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