I don't understand what I have to do


#1

Write a function called perimeterBox that returns the perimeter of a rectangle.
It should have two parameters.
One formula for perimeter is length + length + width + width;
Call the function and pass in any value for length and width you like.

I have this:
var perimeterBox = function (3, 9){
return length * 2 + width * 2;
}


#2

write :

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

At the end call the function :

perimeterBox(3,9);


#3

Before posting any code you should try to explain why he got an error instead of just giving him the solution.:slight_smile:


#4

Sorry if you mind :slight_smile:
Now listen

  1. You just defined the functions perimeters as a value i.e function(3,9) instead of giving it a name like function(length,width)

  2. You didnt call a function at the end of the code like this:

perimeterBox(5,8);

NOTE: calling the function is place where you give it a value


#5

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