Question 9


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


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


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


Here's the function:

var perimeterBox = function(length, 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.


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)