They say you must return with a perimeter value of 4(eg. perimeter(4)).

This is my code:

var perimeterBox= function(length,length,width,width)

{

return length + length + width + width;

};

perimeterBox(1,1,1,1);

what's wrong with it?

They say you must return with a perimeter value of 4(eg. perimeter(4)).

This is my code:

var perimeterBox= function(length,length,width,width)

{

return length + length + width + width;

};

perimeterBox(1,1,1,1);

what's wrong with it?

why 4 parameters? you can easily use a parameter multiply times:

```
var example = function(x){
return x + x + x
}
```

no need for 4 parameters/arguments, two is enough.

yes, since variable can be overwritten, so can function parameters, so using the same parameter name is wrong

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