9.Function with 2 parameters problem


I'm pretty sure my code is correct, but every time I run this it tells me I'm not returning 4 when 4 is right there on the display screen. I've tried everything including logging out and back in, and rewriting the code. Does anyone have an answer to my problem? Thank you.


I guess the problem is that you use console.log instead of return.
console.log outputs to the screen whereas return outputs to the program that is calling the function.

So when you have something like this:

4 === perimeterBox(1,1)

then your code won't work, you see the 4 on the screen yes but the statement perimeterBox(1,1) would have a value of undefined and not 4 like it would have if you'd used return.


Thank you for that solution! I forgot about trying to use the return keyword!