More Kinds of Methods


More Kinds of Methods
hi ,what is wrong with it ?
it told me:Oops, try again. It looks like you have an error in your code. Here’s the message: TypeError: square.calcArea is not a function.

thanks for your help .

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

var p = square.calcPerimeter();
var a = square.calcArea();

var square=new Object();
     return this.sideLength*this.sideLength;

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>


Replace this line with your code.

<do not remove the three backticks above>


this comment is quit helpful:

// help us define an area method here

you can’t call a method before you defined, so define the method where the comment says you should, then your method call is after the method declaration, and you should be good


thanks ,i had solved the problem