I can't figure out what I did wrong. PLEASE HELP!


#1

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


#2

functions with two perimeters:

var perimeterBox = function(length,width)
{
var length = 2 // no need for this !
var width = 1 //no need for this !
return length + length + width + width} // here , there is a sintax problem , watch out for the ending...
};

var length = 1 // no need
var width = 1 // no need
return length + length + width + width
} // no need

well, this part..
var length = 1 // no need
var width = 1 // no need
return length + length + width + width
you are supposed to "call the function" and then print the output with console.log

hope it helps... its simpler than you think!


#3

OK! Thanks so much. I'm just beginning this, and this answer clears a lot up!


#4

yeah no problem!! Im new also !!
bare in mind that when you "call the function" , that is , perimeterBox () inside the ( ) youre supposed to include the values you want...
I tried to give you a hint ,not the complete answer... !

:sunny:


#5

I am wrong in assuming you can't just call the function with its parameters inside of a console.log statement? That would make it a lot more compact, that way it will immediately give the console statement without all the extra typing.


#6

Sure you can in the end a function call is just a value an can be used wherever a value can be used so

console.log(perimeterBox(1,2));

would be possible.