Last updated 2022-11-05 03:50:45

What Is A Parameter?

Table of contents


When you take a look at mathematical formulas most of them usually have alphabets say x or y in them, and the intention is that anyone using these formulas will replace the x and ys with actual values. In the programming world functions can be viewed as these formulas and parameters will be the x and ys.

Use Cases and Examples

Here is an example of a function in Javascript that adds two parameters together:

01: // declaring the function 02: function adder(a, b) { 03: return a+b; 04: } 05: 06: // using the function 07: adder(1,2);

What you have above is a function called adder that takes two parameters and returns the sum of a and b. The last bit of the code [→] shows how you will use this function. You will refer to the values you pass in to replace the parameters as arguments [→].


Parameters are key to how we end up getting different behaviors out of the same piece of code.

Here is another article you might like 😊 "What Is A Parser?"