Functions....Please help

Tell us what’s happening:
Please how do I achieve this - functionWithArgs(7,9) should output 16

Your code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36.

Challenge: Passing Values to Functions with Arguments

Link to the challenge:

1 Like

Where you are calling the function:

functionWithArgs(7,9);

you are passing in two parameters: 7 and 9.

In the function definition:

function functionWithArgs(one,two){

You are accepting those parameters and storing them in the variables called one and two. You could have called them anything, but this is what was chosen.

Then when you output, you have hard-coded the numbers 1 and 2.

console.log(1+2);

But instead you need to use the variable names that you used to accept the parameters on the line before.

Does that make sense?

3 Likes

Oh yeah. Thanks alot