#9/13 dont add up


#1

help i cant work out why this does not return 8??

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

var newNumber = perimeterBox (2,2,2,2)
console.log(newNumber)


#2

Try this

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

var newNumber = perimeterBox(2,2)
console.log(newNumber)

It seems you declared width as being Width in the function declaration.
Also when you define your newNumber variable with

var newNumber = perimeterBox (2,2,2,2)

you actually should only put two arguments in there like

var newNumber = perimeterBox (2,2)

Since they correspond to length and width in your function declaration.
If you had made your function like this

var perimeterBox = function (length, width, color) {
    //some code
};

Then you could define something with

var newNumber = perimeterBox(2, 2, "red")

since it's using the third argument color in the declaration. Hope this helps.


#3

thanks

i get it. i didn't realise i only need to declare length once.