· By John Kavanagh

Parameters vs. Arguments: What's the Difference?

Abstract image used to represent Parameters vs. Arguments in JavaScript
Image by Edgar Chaparro, licensed from Unsplash.

In Brief

The function definition declares parameters; each call supplies arguments. In function repeatLabel(label, count), the declared inputs are parameters. In a call such as repeatLabel('Hi', 2), the supplied values are arguments. Defaults, rest parameters, and destructuring change how values bind, but don't change the terms.

One Definition, Different Calls

Consider a small function which repeats a label:

function repeatLabel(label, count) {
  return label.repeat(count);
}

repeatLabel('Hi', 2);  // 'HiHi'
repeatLabel('Go', 3);  // 'GoGoGo'

label and count are parameters; the calls supply 'Hi' and 2, then 'Go' and 3 as arguments.

That is the distinction described in MDN's definitions of a parameter and an argument. You may also encounter "formal parameter" and "actual argument" in textbooks or specifications.

The caller's variable name doesn't have to match the parameter. A value held in message can be passed to repeatLabel(message, 2); inside the function it binds to label. JavaScript matches positional arguments by position.


Arguments Can Be Expressions

An argument can be a variable, a calculation, or a function result, not just a literal. repeatLabel('Go', 1 + 2) passes the result of the addition. The parameter count receives that value, not the source text 1 + 2.

When a function gets the wrong value, check both the call expression and the definition. Renaming a parameter won't change what the caller supplies. Adding or moving a positional parameter can shift what existing calls mean, so check those callers before changing the interface.


Counts Don't Always Match

JavaScript doesn't generally require the number of supplied arguments to match the declared parameters. With ordinary parameters, an omitted argument leaves its parameter undefined; calls may also supply extra arguments without a matching named parameter.

That doesn't mean every function can usefully accept any number of arguments. Its implementation may reject a missing value or fail when it tries to use one. Language‑level calling behaviour and an application's contract are separate things.

Default parameters provide one way to define a value for an omitted or explicitly undefined argument. They don't apply to every value which happens to be false‑like. The guide to default parameters covers that behaviour without needing to make "argument" and "parameter" interchangeable.


An Options Object is One Argument

Consider another small example:

function describeCard({ title, compact = false }) {
  return compact ? title : title.toUpperCase();
}

const options = { title: 'News', compact: true };
describeCard(options);  // 'News'

The call supplies one argument: the value of options. The definition uses one destructuring parameter pattern to create local bindings for title and compact. The two properties don't turn the call into two positional arguments.

People sometimes call this "named arguments", but the call passes one object; the function reads or destructures its properties. Those property names are part of the interface, so changing a local binding and changing an external key are different edits.


The Arguments Object is a Separate Topic

JavaScript also has the specifically named arguments object in ordinary functions. Its name refers to information about the arguments supplied to an invocation. Rest parameters provide another way to collect supplied arguments into an array.

Those are ways to access supplied values, not different meanings of the two terms. The comparison of the arguments object and rest parameters explains their practical differences.

Outside function calls, "parameter" has other established uses, including query parameters and configuration parameters. Don't turn the function terminology into a claim that every use of "parameter" elsewhere must be wrong.


Planning a platform change?

I help teams make difficult platform work clearer, from architecture decisions and migrations to launch recovery, performance, and search visibility.