Argument
ELI5 — The Vibe Check
An argument is the actual value you hand to a function when you call it. If a function is a coffee machine and it needs beans and water, the specific beans and the specific water you pour in are the arguments. You're giving it the real things.
Real Talk
An argument is the actual value passed to a function at call time. It is often confused with 'parameter' — parameters are the names in the function definition; arguments are the values provided when calling it. Some languages support named, default, and variadic arguments.
Show Me The Code
function greet(name: string) { // 'name' is the parameter
return `Hello, ${name}!`;
}
greet("Alice"); // "Alice" is the argument
When You'll Hear This
"Pass the user ID as an argument." / "The function takes three arguments: start, end, and step."
Related Terms
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.
Parameter
A parameter is the placeholder name inside a function definition — it's the label on the slot where you plug things in.
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.