More kinds of methods


what is wrong with this code???!!

sideLength was 0 where it returned NaN instead of 0

var square = new Object();
square.sideLength = 6;
square.calcPerimeter = function() {
  return this.sideLength * 4;
// help us define an area method here
    return this.sideLenght * this.sideLenght;
var p = square.calcPerimeter();
var a = square.calcArea();


HI thsi line

return this.sideLenght * this.sideLenght;

you wrote ..Lenght instead of ..Length


Still doesn't work with the code above after fixing the mistakes in it.


It should work after fixing typos.

Please post your code after corrections.


oh oh :frowning:


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