Passing Values to Functions with Arguments? Help

Tell us what’s happening:
Can anyone help me with parameters?

Your code so far

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

// Only change code below this line.
function functionWithArgs(a,b)



Your browser information:

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

Link to the challenge:

It’s asking you to log the sum of the given parameters. The parameters are a and b. So the function should have: console.log(a + b)

Hi your function looks okay though it is missing an opening bracket. Also for your log statement, you should be using “a” and “b” which will add the arguments you provide. Such as the “3” and “16” in your function call.

Right now it will just add “1+2”. To clarify a little more the function is taking in those numbers you provide which are arguments and then will be used as the current value for the parameters which are “a and b” they are temporary copies only used in the function.

This is what my code looks like now. it says haven’t output three and it also asked for 16 output which i have completed.

The inside of the function needs to use the arguments a and b. Your code right now will always output 1 + 2 and then 7 + 9.

If you decided to do that because of the tests, there is no need because the program will automatically run those tests. Even if you wanted to run them yourself, you would do it by calling the function, not by writing them inside the function.

This question is about passing arguments to a function. This is done using variables. In this case, a and b. You want to do console.log(a + b) inside the function so that no matter what two numbers are passed in, it will always return their sum. The way your code is currently written, it will always output 3 and 16 regardless what numbers are passed in.