Passing Values to Functions with Arguments - confusing syntax error

Tell us what’s happening:

Your code so far

// Example
function ourFunctionWithArgs(a, b) {
  console.log(a - b);
ourFunctionWithArgs(10, 5); // Outputs 5

// Only change code below this line.
functionWithArgs(x, y) {

functionWithArgs(2, 5);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0.

Link to the challenge:

The console gives the following syntax error:

"SyntaxError: unknown: Unexpected token, expected ; (8:23)
6 |
7 | // Only change code below this line.

8 | functionWithArgs(x, y) {
| ^
9 | console.log(x+y);
10 | }
11 |

Can somebody help me see what I am doing wrong? To me, the syntax looks just like the one in the example code.

Thanks a bunch


Take a look at how the example function is declared - yours appears to be missing an element. :slight_smile:

slaps hands against forehead I see it now - thank you!

I missed the function keyword and so the console expected a one-line statement and asked for its closing semicolon.

1 Like