DEV Community

sdcaulley
sdcaulley

Posted on

Functions - Arguments vs Parameters

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);
Enter fullscreen mode Exit fullscreen mode

a and a * 2 (actually, the result of a * 2, which is 6) are the arguments to the foo(..) call. x and y are the parameters that receive the argument values (3 and 6, respectively).

from Functional-Light JavaScript by Kyle Simpson

Top comments (0)