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 trialPavle Lucic
10,801 PointsDifference between argument and parameter?
What is the difference between argument and parameter?
2 Answers
Robert Richey
Courses Plus Student 16,352 PointsHi Pavle,
Arguments are what get passed into function calls.
Parameters are what the function will accept, when called.
// function defined with two parameters
function foo(meat, fruit) {
console.log("For meat, you picked: " + meat);
console.log("For fruit, you picked: " + fruit);
}
// function called with two arguments
foo("bacon", "apple");
vryiziilos
Full Stack JavaScript Techdegree Student 23,052 PointsI actually had the same question. I just remember that arguments is like "arguing" against the function by supplying your "arguments" against function's parameters. Sounds silly, but that's how I remember the difference :)
Pavle Lucic
10,801 PointsPavle Lucic
10,801 PointsTnx, I realized that after watching the next video :) Cheers Robert!
Chris Harkin
1,104 PointsChris Harkin
1,104 PointsHi @Robert Richey thanks for this answer but am still a little confused.
Would I be correct in saying the parameters are like place holders for the values and the arguments are the actual values.