Functions - Arguments vs Parameters

sdcaulley

sdcaulley

Posted on September 30, 2020

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

💖 💪 🙅 🚩
sdcaulley
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.

Related

Functions - Arguments vs Parameters
javascript Functions - Arguments vs Parameters

September 30, 2020