18/33 Working but no output


#1

The go to next lesson green button pops up with my code below but I don't get any values outputing from the return statements.

Shouldn't the perimeter and area values output for a side length of 6?

Also it is not explained why you call the methods with var p and a?

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

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


#2

Return statements aren't supposed to print anything on the console. That's console.log's job. They also called the variable p and a because p can stand for perimeter and a can stand for area. Really, it doesn't matter.

Also, you multiply the side length by 4, so it wouldn't be 6, it would be 24(I think).


#3

Thanks ragezapper. So I guess my code is good. Yes I was getting confused between console.log and return.