Parameter

garanews's avatar
Published Apr 19, 2021Updated Oct 26, 2022
Contribute to Docs

A parameter is the name of a variable passed into a function. Parameters allow functions to accept inputs. An argument, on the other hand, is the actual value of the variable (also known as the parameter) passed into a function.

  • Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
    • Beginner Friendly.
      15 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours

Example

Suppose we have a function called tripleThis():

function tripleThis(x) {
return x * 3;
}
tripleThis(6);

The parameter is x since it is the variable. The argument is 6 since it is the actual value.

All contributors

Contribute to Docs

Learn General on Codecademy

  • Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
    • Beginner Friendly.
      15 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours