Can some one help me with this question?


#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.


#2

Could you post your attempted code?


#3

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

return (1+1+1+1);

i had a few other tries and all were syntax error


#4

var permimeterBox = function(length, width){ //Declaring function with the parameters length and width.
    return (length + length + width + width); //Returning the perimeter using those values.
}

#5

thanks,
but how do you define the perimeterBox function?


#6

var perimeterBox = function(...){...}