9. Functions with two parameters


#1


Replace this line with your code.


#2

Well, lets take a look at this lesson based on the instructions. "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;" It has given us our variable (perimeterBox) , it is a function, the parameters of the function (length and width) it has given us the formula for perimeter to return the perimeter (length + length + width + width;). So now we build it:

variable perimeterBox = function(length, width) {

         return length + length + width + width; };

Finally we need to call the function and pass any value in the parameters that we would like for length and width.


#3

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