9/13


#1

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;
};
perimeterBox(1,2);

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?


#2

SyntaxError: Unexpected token

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

#3

I did this but don't understand what return does


#4

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


#5

10000watts, you have to remove the semicolon.


#6

Semicolons should be placed after function calls e.g.

console.log("Something");

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.