More Kinds of Methods


#1


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


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


var square = new Object();
square.sideLength = 6;
square.calcPerimeter = function() {
  return this.sideLength * 4;
};
square.calcArea = function() {
    return this.sidelength * this.sidelength;
};
// var p = square.calcPerimeter();
var a = square.calcArea();


#2

Your problem is you need an capitol L in sidelength so like this

return this.sideLength * this.sideLength;

#3

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