More kinds of methods


...i can't figure out what's wrong with the second method here, returns NaN

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();


Did you mean to write, sideLength? JavaScript is case sensitive.


Thanks for pointing that out :slight_smile:


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