Parameters versus arguments

Published February 10, 2021

When speaking about functions in programming, it is common to confuse the terms parameters and arguments. What does each term refer to and which one should you use? Let's find out.

  • Function parameters are the names that are listed in a function's definition.
  • Function arguments are the real values that get passed to the function.

Parameters are initialized to the values of the arguments supplied. Parameter variables are used to import arguments into functions.

Example of parameters and arguments

Let's use JavaScript to create a simple example that will help to better understand the difference between parameters and arguments.

function divide(numerator, denominator) {
  return denominator > 0 ? numerator / denominator : 0;

console.log(divide(10, 5)); // 2

The parameters of this function are numerator and denominator seen in the function definition of function divide(numerator, denominator). The arguments are the values of 10 and 5 that get passed to the function in the function call of divide(10, 5).