var square = new Object();
square.sideLength = 6;
square.calcPerimeter = function() {
return this.sideLength * 4;
square.calcArea = function () {
return this.sideLength * this.sideLength;
var p = square.calcPerimeter();
var a = square.calcArea();

My code works fine, but i want to know why we declared two variales named p and a . And also i tried calling the functions but they dont seem to work.
square.calcArea(10); doesnt give me any result. Help .!


In order to recieve outpur you must call it on an object.


When creating the functions there are no parameter place holders in the parenthesis, so these functions simply work with existing values in the sideLength property.