Passing Values to Functions with Arguments

Hello! Welcome to the community :partying_face:!

Those values come from the parameters you pass to the function when you call it.

On this line functionWithArgs(10, 5) you’re calling the function and passing two parameters: 10 and 5

These parameters (10 and 5) are assigned to the variables a and b on the definition of the function here:

function functionWithArgs(a, b) {
    // At this point, a = 10 and b = 5
    console.log(a + b);
}

Does it help?

Check this out if my explanation doesn’t help: click here.


Also:

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').