perimeterBox function seems not to validate


Oops, try again. It looks like your perimeterBox function doesn't return the correct perimeter (4) for a width of 1 and a length of 1.

var perimeterBox = function(length, length, width, width) {
    return length + length + width + width;



Why do you have two of the same parameters?
Won't it be better if it's just length and width instead of length, length, width, width in function(length, length, width, width)?


I was trying to make it work for a polygon of various side lengths.

var perimeterBox = function(length1, length2, width1, width2) {
    return length1 + length2 + width1 + width2;


This is how is should have been, but I realise why it was not working.

The task asked to use only 2 parameters.

I didn't read the task properly. My bad.

Thanks anyway for responding fat cat.


If it's a polygon with varying sides, then it would be fine. But I think Codecademy wants a rectangular box and not a trapezoid, rhombus, etc. (they should be more specific on that tbh).

Haha, no problem! have fun coding :slight_smile:


I always have fun :smile: :smile: :smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.