Skip to content

Argument

In one line

An argument is the actual value you pass into a function when you call it, filling the parameter's slot.

In simple words

An argument is the concrete value you provide when calling a function. If the function is a form with blank fields (parameters), the arguments are the values you write into those fields before submitting.

For example, add(2, 3) calls the add function with arguments 2 and 3. These values are assigned to the function's parameters and used inside the body to compute the result.

Arguments can be literals (5, "hi"), variables (userAge), or even the result of another function call (add(multiply(2, 3), 4)). The number and order of arguments must match the function's parameters.

Example

javascript
function add(a, b) {
  return a + b;
}

// 2 and 3 are ARGUMENTS (values at call time)
const result = add(2, 3);
console.log(result); // 5

// Arguments can be variables too
let x = 10, y = 20;
console.log(add(x, y)); // 30

2 and 3 are arguments — the actual values passed to add. They fill the parameter slots a and b.

Common confusions

  • Confused with: parameter

    The difference: An argument is the actual value passed at the call site; a parameter is the named placeholder in the function definition. Arguments fill parameters.

Related terms

Related Resources

Related Lessons

  • Functions

    Arguments are introduced with functions

Learn the fundamentals

Deepen your understanding with structured lessons on this topic.

View lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary