Question 9


#1

I just started learning "return" and i don't understand the concept!

I don't know how to make two parenthesis, I am Just stuck
This is the question:
1.Write a function called perimeterBox that returns the perimeter of a rectangle.
2.It should have two parameters.One formula for perimeter is length + length + width + width;
3.Call the function and pass in any value for length and width you like.

This is where I am stuck


#2

First declare a two parameter as an argument in function inside the brackets anything you want and the double each values and sum up.
var peremiterBox = function(width, height) {
result = width*2 + height*2
return result
};


#3

Maybe this is useful for you if you are completely lost:


#4

Here's the function:

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

and how to call it:

perimeterBox(10, 15); //Change the numbers to whatever you want.

Parameters are the things in the brackets ().

See how much you can figure out from this. If you need more help, feel free to ask.


#5

Thank you, I now understand it.
I am also trying to understand when you have two variables, example:

Var timesTwo = function(number){
return number*2;

Var newNumber = timesTwo(15)
console.log (newNumber)
??