JS Function Parameters vs Arguments Differences

Parameters are placeholders. Arguments are actual values. Learn the difference, why it matters, and how JavaScript handles argument mismatches without throwing errors.

5 min read

The difference between a parameter and an argument can be summed up in one sentence: a parameter is a named placeholder in the function definition, and an argument is the actual value passed when calling the function.

Here it is in one clear example:

javascriptjavascript
//  price  and  quantity  are PARAMETERS (placeholders)
function calcTotal(price, quantity) {
  return price * quantity;
}
 
//  19.99  and  3      are ARGUMENTS (actual values)
calcTotal(19.99, 3); // 59.97

The names are defined once when you write the function. The values change every time you call it. That distinction is simple but important.

Quick Comparison

ParameterArgument
WhereIn the function definitionIn the function call
What it isA named variable placeholderA concrete value or expression
When setWhen the function is definedWhen the function is called
LifetimeLives inside the function bodyEvaluated once per call, then bound to the parameter
ExampleIn function foo(x, y), x and y are parametersIn foo(10, 20), 10 and 20 are arguments

Why the Distinction Matters

If you mix up parameters and arguments, you might write confusing explanations in code reviews or misread error messages. But the practical reason the distinction matters is that JavaScript handles mismatches between them silently.

If you pass fewer arguments than there are parameters, the extra parameters become undefined. If you pass more, the extras are ignored by the named parameters but still accessible.

Understanding this behavior lets you debug function calls that do not behave as expected.

What Happens When Arguments Do Not Match Parameters

Fewer Arguments Than Parameters

javascriptjavascript
function introduce(name, age, city) {
  console.log(`${name} is ${age} and lives in ${city}.`);
}
 
introduce("Alex", 25);
// "Alex is 25 and lives in undefined."

No error. The city parameter is undefined. JavaScript fills parameters left to right, so calling a function expecting three values with only two leaves the third slot empty.

More Arguments Than Parameters

javascriptjavascript
function showFirst(a) {
  console.log(a);
}
 
showFirst(10, 20, 30);
// 10

No error. The extras (20 and 30) are silently ignored by the named parameter. But they are not lost, you can still access them through the arguments object in regular functions:

javascriptjavascript
function showAll(a) {
  console.log("Named parameter:", a);
  console.log("All arguments:", arguments);
}
 
showAll(10, 20, 30);
// Named parameter: 10
// All arguments: [Arguments] { '0': 10, '1': 20, '2': 30 }

Passing by Value vs Passing by Sharing

When you pass a primitive as an argument, the function gets a copy. Changing the parameter inside the function does not affect the original:

javascriptjavascript
function changeValue(x) {
  x = 100;
  console.log("Inside:", x);
}
 
let num = 5;
changeValue(num); // Inside: 100
console.log(num); // 5 -- unchanged

When you pass an object, the function gets a reference. Mutating the object's properties affects the original, but reassigning the parameter does not:

javascriptjavascript
function updateCar(car) {
  car.color = "blue";     // Mutates the original object
  car = { color: "red" }; // Reassigns the local parameter only
}
 
const myCar = { color: "black" };
updateCar(myCar);
console.log(myCar.color); // "blue" -- mutated, not reassigned

This is called pass by sharing. The parameter holds a reference to the same object, so property changes are visible outside. But reassigning the parameter variable itself only changes the local binding.

Argument typeWhat the function receivesReassignment inside the functionMutation inside the function
Primitive (number, string, boolean)A copy of the valueHas no effect on the originalNot possible, primitives cannot be mutated
Object or arrayA reference to the same objectOnly changes the local variableVisible on the original object

Default Parameters: Handling Missing Arguments

Instead of checking for undefined inside the function body, you can set default values directly in the parameter list:

javascriptjavascript
// Without defaults (old way)
function greet(name) {
  name = name || "Guest";
  console.log(`Hello, ${name}!`);
}
 
// With defaults (modern way)
function greet(name = "Guest") {
  console.log(`Hello, ${name}!`);
}
 
greet();        // "Hello, Guest!"
greet("Sara");  // "Hello, Sara!"

The default only activates when the argument is undefined, not for other falsy values like null, 0, or "". Learn more in How to Use Default Parameters in JS Functions.

For a broader introduction to functions, see What Is a Function in JavaScript Beginner Guide.

Common Beginner Mistake: Naming Confusion

Beginners often say "I passed the parameter 5" when they mean "I passed the argument 5." In casual conversation, people understand. But in technical discussions, the wrong term can cause confusion, especially when discussing function signatures, TypeScript types, or API design.

A simple rule to remember:

  • If you are writing the function, you are working with parameters.
  • If you are calling the function, you are working with arguments.

Arguments in Arrow Functions

Arrow functions do not have their own arguments object:

javascriptjavascript
const show = () => {
  console.log(arguments);
};
 
show(1, 2, 3); // ReferenceError: arguments is not defined

If you need to capture all arguments in an arrow function, use rest parameters instead. A rest parameter collects every argument into a real array, which arrow functions can read normally:

javascriptjavascript
const show = (...args) => {
  console.log(args); // [1, 2, 3]
};
 
show(1, 2, 3);

Where to Go Next

Parameters are the named slots you define in a function signature, and arguments are the real values that fill those slots at call time. Keeping that distinction straight makes it easier to debug mismatched calls and read function signatures in any codebase.

Rune AI

Rune AI

Key Insights

  • Parameters are the names in the function definition. Arguments are the values in the function call.
  • Missing arguments become undefined. Extra arguments are accessible through the arguments object.
  • Object and array arguments are passed by sharing, meaning mutations inside the function affect the original.
  • Use default parameters to handle missing arguments gracefully.
  • The arguments object is only available in regular functions, not arrow functions.
RunePowered by Rune AI

Frequently Asked Questions

Can I use the words parameter and argument interchangeably?

In casual conversation, people often do. But in precise technical writing and interviews, the distinction matters. Parameters are in the definition. Arguments are in the call.

Does JavaScript throw an error for missing arguments?

No. JavaScript sets missing arguments to undefined inside the function. This is different from languages like Python or Java, which raise errors for argument count mismatches.

What is the arguments object?

The arguments object is an array-like object available inside regular functions. It contains all arguments passed during the call, even extras that have no corresponding parameter.

Conclusion

Parameters and arguments are two sides of the same coin. Parameters are the named slots you define in a function signature. Arguments are the real values that fill those slots at call time. Understanding the distinction helps you write clearer code, debug argument mismatches, and explain function behavior to other developers.