Basic JavaScript - Passing Values to Functions with Arguments

*I’m correct in the format as in (param1, param2) I think but when I input {console.log(1,2); {console.log(7,9);} either as (1,2) (7,9) or (1 + 2) (7 + 9) I get a reply of ‘SyntaxError: unknown: Unexpected token (3:22)’ even though the initial program of (param 1, param 2) {console.log(3);} submitted the call once inputed and replied with 3. Could be sat here all day and night working this challenge out! I’m not entirely sure where I’m making the mistake either and wouldn’t pass on a direction at this point :slightly_smiling_face:
My code so far

function functionWithArgs(param1, param2){console.log(1,2); {console.log(7,9);}
functionWithArgs(1,2);
functionWithArgs(7,9);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15

Challenge: Basic JavaScript - Passing Values to Functions with Arguments

Link to the challenge:

SyntaxError is caused by the second opening bracket { without the closing one.

Also tried that so moved on from that, its missing one argument which is currently:

function functionWithArgs(param1, param2) {console.log(1 + 2);} {console.log(7 + 9);}

functionWithArgs(3, 16);

with all correct apart from {console.log(7 + 9);}. the message reads “functionWithArgs(7,9) should output 16” (which visually it does but guess its not inputted correctly)?

There’s no need for the second set of brackets :slightly_smiling_face:. Function has one opening and one closing one. If you want to call them both from inside function:

function functionWithArgs(param1, param2) {
  console.log(1 + 2);
  console.log(7 + 9);
}

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.