/this-vs-that GitHub 1316★

argument vs parameter

Difference

A parameter is the variable belonging to the declaration of a function.

An argument is the actual value of the parameter that is passed to the function.

Assume that we have a function that calculates the sum of two numbers:

const sum = function (a, b) {
return a + b;
};

here a and b are the parameters. If we call the function, sum(1, 2), then 1 and 2 are the arguments.

Tip

There is a handy memory hook to distinguish these terms:

Parameter → Placeholder

Argument → Actual value

Follow me on and to get more useful contents.