Weren’t They the Same?

Sometimes arguments and parameters are mixed and used without much distinction. But strictly speaking, the two terms differ.

First, consider parameter. It refers to variables declared in a function definition.

Example:

// Here, x and y are parameters.
function foo(x, y) {
    // ... something
}

Next, consider argument. It refers to the actual values passed when calling a function.

// Here, 2 and 3 are arguments.
foo(2, 3);

With this distinction, it is common to think of parameters as variables and arguments as values.