DEV Community

sdcaulley
sdcaulley

Posted on

1 1

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)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay