Basic JavaScript - Passing Values to Functions with Arguments

Tell us what’s happening:
Hello. I have a comment for this task.
(p.s. now I found the correct answer of that task on GitHub article).

I didn’t understand where did the data come from about “a” and “b” arguments in this task and where did the data come from about 10 and 5 numbers?

In this task example don’t have any data about that arguments and numbers. I think this task have incorrect information, or I misunderstood this task.

Sorry for my English

  **Your code so far**
function functionWithArgs(a, b) {
console.log(a + b);
}
functionWithArgs(10, 5);
  **Your browser information:**

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

Challenge: Basic JavaScript - Passing Values to Functions with Arguments

Link to the challenge:

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

This is a function definition. It creates a function named functionWithArgs that has two parameters. The first parameter is named a. The second parameter is named b. When this function is called, it will log to the console the result of + on the first parameter and the second parameter.


functionWithArgs(10, 5);

This is a function call. It invokes the function I described above, with the first argument being 10, and the second argument being 5.

So in this case a + b would be 10 + 5 and 15 would be logged to the console.

If you call the function with different values, you’ll get a different result.

1 Like

Thank u so much. Now I understood