Arguments and Parameters - the difference

I have been learning JavaScript for a while now and have come across functions. In functions we have something known as arguments and parameters. I would like to clearly know the difference between the two (if there’s any).

You define the parameters of a function once while you call the arguments multiply times. That is one difference I know.

free explained in my words:
A function is just a block of code that I write once and use it whenever I need it. This block of code is getting parameters just to clarify what expect to work with. And later on I use the arguments of a function whenever I use this function.

1 Like

Parameters are used in the definition of the function

function add(x, y) {
  return x + y;

There are two parameters and they are called x and y.

Arguments are the actual values that get passed in when a function is called

add(1, 2);

The arguments are 1 and 2

In sentences:

The function add has two parameters, x and y, which represent numbers.

The function add takes two arguments, both numbers.

Edit: Note this is a bit different to in maths: what’s called “parameters” in CS is called “arguments” in maths; parameters are a different thing.


So is it similar to the concept of Actual arguments and Formal arguments in C language ? I mean as you have explained I can see that the parameters in a Javascript function can be thought of as Formal arguments of C and arguments can be thought of as Actual arguments of C language. Does it make sense ?

That might be somewhat dated language.

I wouldn’t loose too much sleep on the distinction, personally.

1 Like