Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Functions Pass Information Into Functions Pass Multiple Arguments to a Function

The Concept Of Parameters And Arguments

What should I do to understand more the difference and when they are used for?

Thanks in advance.

4 Answers

Steven Parker
Steven Parker
231,275 Points

Arguments are passed to a function or method when you call it. For example:

    roll = randBetween(1, 6);      // <-- the "1" and "6" are both arguments

And parameters are defined along with the function or method, and represent the arguments that will be passed later:

function randBetween(low, high) {  // <-- "low" and "high" are both parameters

Does that clear it up?

Yes thanks a lot!!

Thanks a lot!

this is so easy to understand. thank you

Miguel Valenzuela
Miguel Valenzuela
1,254 Points

A parameter is the box and the thing that goes in the box is the argument.

how i understood is :

if used with calling function -> arguments.

if used on function definition -> parameters.