Basic JavaScript - Passing Values to Functions with Arguments

Hi, I have a big problem with this. I have read a lot but i can´t found out my problem. I have tried a lot of things but i can not resolve it. I will be so grateful if someone can help me with this.
Thank you so much, I hope an answer for some kind person.

function

SyntaxError: unknown: Unexpected token (1:8)

1 | function
| ^

function functionName() {}
type the whole thing the error you are seeing is because you haven’t completed the function structure

I think that it isn´t the cause. Althoug, I write all de code doesn´t work. Look:

function functionWithArgs(1,2) {
console.log(1+2);
}
function functionWithArgs(7,9) {
console.log(7+9);
}
SyntaxError: unknown: Unexpected token (1:26)

1 | function functionWithArgs(1,2) {
| ^
2 | console.log(1+2);
3 | }
4 |

This is wrong.

function functionWithArgs(a, b){
console.log(a+b)
}
functionWithArgs(7,9)

You have to set parameters a, b or any other variable names and perform action on those variables
Then call function and pass argument values like 7 or 9 or other types.

1 Like

Thank you so much nkp1111. Blessings to you and to your family.
Have a nice day. You have really helped me.