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 trialPascal El Murr
2,577 PointsThe 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
231,248 PointsArguments 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?
Jonathan Drake
Full Stack JavaScript Techdegree Student 11,668 PointsLate to the party but this was perfect. Thanks.
Miguel Valenzuela
1,254 PointsA parameter is the box and the thing that goes in the box is the argument.
ulli ello
1,597 Pointshow i understood is :
if used with calling function -> arguments.
if used on function definition -> parameters.
Pascal El Murr
2,577 PointsPascal El Murr
2,577 PointsYes thanks a lot!!
Hussein Ammar
11,106 PointsHussein Ammar
11,106 PointsThanks a lot!
Peter Huang
5,427 PointsPeter Huang
5,427 Pointsthis is so easy to understand. thank you