More Methods (Needs Debugging)


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


#2

Here's the error:

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


#3

Capitalisation is important.


#4

Oh. Thank you again!


#5

Most welcome, you are storming through this course! Well done.


#6

Thank you! I'm trying to be productive with my time, so I decided to give this a try.


#7

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