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

I have doubt in Javascript function : Pass an argument module.

In code challenge it asked : Modify the returnValue function to accept one argument named value.

The accepted answer was :

function returnValue(value) { }

I'm confused whether 'value' was an argument or a parameter ?

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Hi Soumya,

In your code challenge what you've entered is a parameter. Which is a variable that goes inside the function parentheses that is a kind of holder for the argument that you will, later on, use in your function call.

//function definition
function returnValue(value) {
}

So you've defined your function above, inside which you'll perform an action that uses the value parameter.

To give value a an actual value you would call the function with an argument. Like below.

//function call
let functionCall = returnValue(5);

where 5 is your function argument and value is your function parameter.

I hope I've helped with your query :)

I now have a better understanding. Thanks, Jonathan. :)