Imagine a function that returns the sum of two numbers:
function add(x, y) {
return x + y;
}
Now imagine a line of code that uses the function:
let total = add(price, tax);
x
and y
are parameters. price
and tax
are arguments.
Parameters are defined as part of a function definition. They’re properties of your function.
Arguments are the things you pass into a function. They’re properties of an invocation of your function.
In practice, this is a nitpicky distinction. You can use these two terms interchangeably and be understood, almost always. (Almost.)