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
Top comments (0)