Ian Marshall logo

Ian Marshall

What is the difference between the terms "arguments" and "parameters"?

These terms generate a huge amount of confusion! You're not alone. But understanding the difference will go a long way toward better engineering in general, and better use of functions, specifically.

Here's a very simple JavaScript function that should seem self-evident, no matter what programming language you're used to:


You feed in a number value for x and you'll get back x + 1. Give the function 5, you'll get 6; give the function -2, you'll get -1; etc.

The function as it's written is intended to work generically, meaning that it will attempt to add one to any value of x, no matter what it is. In fact, the addOne function has no idea what x may be in the future. The value of x is unknown at the time of defining the function, so x truly is a variable: its value will vary.

x is a variable name only, a variable without a value. When used in a function definition, this valueless variable name is called a "parameter."

In order for the function to work, however, an actual value needs to be given to x. The function needs a value to add one to. When you call the function with a number in the parentheses (like addOne(5), or addOne(-2)), you're providing a value for that parameter. This is called an "argument."

In simpler terms, the parameter is the name and the argument is the value. Together, they create a name–value pair, just as we would use for any variable.

It's not surprising these terms are sometimes used interchangeably because it's easy to think of them being equal to each other. But really they're two parts of a whole variable. When the function ends, the argument value is removed from memory and the parameter returns to being valueless or undefined, but ready to take the value of the next argument whenever it comes.

I hope that helps!