Functions - Arguments vs Parameters
sdcaulley
Posted on September 30, 2020
I have been doing some deep dive reading in my pursuit of learning JavaScript better. Today's learning is about functions and specifically the difference between arguments and parameters.
Arguments are the values you pass in, and parameters are the named variables inside the function that receive those passed-in values.
The example:
function foo(x,y) {
// ..
}
var a = 3;
foo(a, a * 2);
a
anda * 2
(actually, the result ofa * 2
, which is6
) are the arguments to thefoo(..)
call.x
andy
are the parameters that receive the argument values (3
and6
, respectively).
from Functional-Light JavaScript by Kyle Simpson
💖 💪 🙅 🚩
sdcaulley
Posted on September 30, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.