first of all I am new at learning coding. In my code I wanted to create a function "Square" which creates a square object by using the length parameter that you passed in.And another function to calculate its perimeter.Here is my code and I could not find my fault can you help me ?
function Square(length){
this.length = length;
}
var calcPerimeter = function() {
return this.sideLength * 4;
};
var calcArea = function() {
return this.sideLength * this.sideLength ;
};
var p = square.calcPerimeter();
var a = square.calcArea();
var calcPerimeter2 = function(n){
return n*4;
};
var square1 = new Square(5);
square1.calcPerimeter2();