9. Functions with two parameters help


It says: 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.

// Write your function starting on line 3

var perimeterBox = function(length,width) {
return 9 * 4;

How to fix this?


I think you should write like this :

return length*width ;


your function should return the width + width + length + length.

Use the function parameters for this. You do understand how parameters work right? They are placeholders, and then when you call the function:


height and width get assigned the value of the arguments you pass into the function when calling the function, this way your function can caculate the perimeter for different values:



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