Parameter vs argument
By FrontendPro Editorial Team Updated 9/26/2026
Answer
A parameter is the name in the function declaration. An argument is the value you actually pass at the call site.
function greet(name, greeting) { // name and greeting are parameters
return `${greeting}, ${name}`;
}
greet("Mai", "Hello"); // "Mai" and "Hello" are arguments
A parameter is a placeholder that exists once, in the definition. An argument is a concrete value that exists per call.
Why the distinction is worth having
It makes error messages and documentation readable. "The second parameter is optional" describes the function; "you passed the wrong argument" describes a specific call. Mixing them up makes a bug report ambiguous.
JavaScript is loose about matching them
Nothing enforces the count:
greet("Mai"); // greeting is undefined — no error
greet("Mai", "Hi", "extra"); // the third argument is simply ignored
fn.length reports the number of declared parameters before the first default or rest parameter, and arguments (in non-arrow functions) holds the arguments actually passed.
Passing is always by value
function change(obj, n) {
obj.id = 99; // visible outside — the value copied was a reference
n = 99; // not visible outside
}
For objects, the reference is copied, so mutating the object is visible to the caller but reassigning the parameter is not. This is often described as "pass by reference", which is misleading — the reference itself is passed by value.
Related terms
Named arguments do not exist in JavaScript; the common substitute is a single options object, which gives the same readability:
createUser({ name: "Mai", role: "admin" });
