What are Argument and Parameter in Javascript with examples
Learn how to think and you are halfway there.
2 min readMay 13, 2020
Most of the people use these terms, parameters, and arguments interchangeably. No one will laugh at you because you said parameter instead of argument or vice-versa. But it doesn't mean you should do it. It might be wise to use the correct term correctly.
Coding is a craftmanship, know your tools better. It will make you better developer.
Let's look at them with examples.
Simple example
An argument is the value of a parameter.
Here a
and b
are parameters and values passed (2, 2)
is the argument.
Extras
Parameter without a default value
Parameter is variable msg
whereas empty
, undefined
, and Hey yo
are arguments passed into greeting() function.