Parameter
ELI5 — The Vibe Check
A parameter is the placeholder name inside a function definition — it's the label on the slot where you plug things in. The coffee machine has slots labelled 'beans' and 'water'. What you actually pour in are the arguments.
Real Talk
A parameter is a named variable in a function or method signature that acts as a placeholder for the value (argument) passed when the function is called. Parameters define what inputs a function accepts and their expected types.
Show Me The Code
// 'base' and 'exponent' are parameters
function power(base: number, exponent: number): number {
return Math.pow(base, exponent);
}
power(2, 10); // 2 and 10 are arguments
When You'll Hear This
"The function signature has too many parameters — consider an options object." / "Add a default parameter value so it's optional."
Related Terms
Argument
An argument is the actual value you hand to a function when you call it.
Function
A function is a reusable recipe. You write the steps once, give it a name, and call it whenever you need those steps done.
Method
A method is just a function that belongs to an object or class. Your Dog object has a bark() method — it's the dog's personal function.
Return Value
A return value is what a function hands back to you after doing its work. You send a coffee machine beans and water, it returns coffee.