18 .Is that a bug?


#1


https://www.codecademy.com/en/courses/spencer-sandbox/1/3?curriculum_id=506324b3a7dffd00020bf661


The error message tells me exactly ( Oops, try again. Make sure to set rectangle's width to 8! )

This is my code
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.setWidth = newWidth;
};
// here change the width to 8 and height to 6 using our new methods
rectangle.setHeight(6);
rectangle.setWidth(8);


#2

Problem is in your code. Are you sure that this line is correct:

this.setWidth = newWidth;

?


#4

@factoradic Oh sir , Thanks alot for your fast response :slight_smile: , I was really stuck there and indeed it was my fault :slight_smile:


#5

You're very welcome :slight_smile:


#6

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