19.33 Can you tell whats wrong here?


#1

var square = new Object();
square.sideLength = 6;

square.calcPerimeter = function() {
return this.sideLength * 4;
};
// help us define an area method here
square.calcArea = function(){
return this.sidelength * this.sidelength;
};

var p = square.calcPerimeter(6);
var a = square.calcArea(9);

//the error says that it returns NAN when the area is 0


#2
return this.sidelength * this.sidelength;

The variable name is, sideLength. JS is case sensitive.


#3

Good catch. Thank you :smile: