19/33 - Error: square.calcArea is not a function


#1
var square = new Object();
square.sideLength = 6;
square.calcPerimeter = function() {
  return this.sideLength * 4;
};
// help us define an area method here
square.caclArea = function() {
  return this.sideLength * this.sideLength;
};
/*square.calcArea = function() {
  return this.sideLength * this.sideLength;
};*/

var p = square.calcPerimeter();
var a = square.calcArea();
  • Under //help us define an area method here comment:

Over here, the calcArea (uncommented) does not work. The commented one is a copy of calcPerimeter and values have been edited and this WORKS.
I cannot find any difference, not even spelling between commented and uncommented one but 1 (commented) works and another one (uncommented) does not work and produces error : square.calcArea is not a function.
Is there a reason why this is happening?


#2

Hi @boardpro67469

Look your line 7, the name of your function... lol

Hold on :wink:


#3

You have typed

instead of


#4

Name of your function is wrong,


#5

:dizzy_face:
[Edit]
thanks guys :smile: