Hi, I'm stuck on lesson 9. I'm not sure what is wrong this is what i have:
// Write your function starting on line 3

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

I know I waste a lot of space and such, but no matter what modifications I do, or if I refresh the page I get error:
SyntaxError: Unexpected token
But there is not token listed. I'm assuming its a space, but I don't know where the space is. Is something else wrong?


SyntaxError: Unexpected token

var perimeterBox = function(length, width); // this semicolon is not needed


I did this but don't understand what return does


return gives you access to the value that you are calculating in the function.

if at the end of your code you collected the result with

var result = perimeterBox(1,2);

we would see that result now holds the perimeter value that was returned in the function

if we did not return any information in the function, then result above would contain nothing


10000watts, you have to remove the semicolon.


Semicolons should be placed after function calls e.g.


or variable assignments e.g.

var name = value;

so for functions value is a bit fancier but still the semicolon should be placed at the end:

var name = function(){};

but placing it between () and {} just crashes your syntax.