Parameter
In one line
A parameter is a named placeholder in a function definition that receives a value when the function is called.
In simple words
A parameter is a variable listed in the function definition. It is a placeholder — a named slot that says "a value will go here when this function is called." The parameter has no value of its own until the function is invoked.
For example, in function greet(name) { ... }, name is a parameter. It describes what kind of input the function expects. The actual value (like "Ada") is called an argument and is supplied by the caller.
Parameters define the shape of a function's inputs. A function with parameters function add(a, b) expects two values. The names you choose for parameters document what each input means, making the function easier to read and use correctly.
Example
// 'name' and 'greeting' are PARAMETERS
function greet(name, greeting) {
console.log(greeting + ", " + name);
}
// "Ada" and "Hello" are ARGUMENTS
greet("Ada", "Hello"); // Hello, Adaname and greeting are parameters (placeholders in the definition). "Ada" and "Hello" are arguments (actual values passed at call time).
Common confusions
Confused with: argument
The difference: A parameter is the named placeholder in the function definition; an argument is the actual value you pass in when calling the function. Parameters are in the declaration, arguments are at the call site.
Related terms
Related Resources
Related Lessons
- Functions
Parameters are introduced with functions
Learn the fundamentals
Deepen your understanding with structured lessons on this topic.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.