19. More Kinds of Methods error regarding sideLength being NaN instead of 0


#1

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


When I click submit this is the error that is shown:

Oops, try again. Your method failed when sideLength was 0 where it returned NaN instead of 0

I tried to refresh the browser (I'm using Chrome) that didn't help, any suggestions would be greatly appreciated!


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();
var a = square.calcArea();


#2

variable names are case sensitive, sideLength is not the same variable as sidelength


#3

Ahh, I missed that thank you!


#4

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