18. Can anyone See what I'm doing wrong


#1

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 = 4;
rectangle.setHeight = 3;

// here change the width to 8 and height to 6 using our new methods
rectangle.setWidth = function (newWidth) {
this.width = newWidth;
};
rectangle.setWidth = 8;
rectangle.setHeight = 6;


#2

The method here should be a function that takes newWidth as the parameter

which you instead did here:

Also, you then change width for instance by doing:

rectangle.setWidth(8);

rather than

Complete for height.


#3

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