Make Your Own Method


#1

var rectangle = {
height: 3,
width: 4
};

function setHeight (newHeight) {
rectangle.height = newHeight;
}

setHeight(6);
console.log(rectangle.height);

function setWidth (newWidth) {
rectangle.width = newWidth;
}

setWidth(8);
console.log(rectangle.width);

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
Says —> " Make sure to finish setWidth and make it a working function!"

I don’t understand what’s wrong here, new values were assigned accordingly, what else needs to be done?

```

Replace this line with your code.

<do not remove the three backticks above>

#2

setWidth should be a method of rectangle object, not a function.

functions can’t access this


#4

Done now, thank you.


#5