Quick Code Tip: Arguments versus Parameters

What’s the difference between Arguments and Parameters?

Arguments and parameters are often referred to interchangeably, but they are in fact, different. Not by much but in order to speak the language among coders, and for the purpose of this quick tip tutorial, we will make the distinction.

Parameters (or formal parameters) are the variables given inside the function declaration

VERSUS

Arguments (or actual parameters) are the values passed to the function.

The distinction is subtle, but parameters are what is initially put into the function definition, whereas the arguments are what you pass in after. Let’s take it one step further with an example function:

function foo(param1, param2) {
    // do something
}
foo(10, 20);

In this function example, param1 and param2 are function parameters, and the values passed to the function (10 and 20) are arguments.