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 an Argument to a Function

Isnt the task ask of us incorrect. It states accept one argument named value. But isn't the task make value a parameter.

Cause If you look right the parathesis next to the function is actually the parameter block not the argument.

script.js
function returnValue(value) {

}

returnValue(value);
index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

Just so you know i did get this challenge correct. Im just asking isn't the task asked incorrect in the definition of what its asking us to do.

5 Answers

Hi!

Now I see your point.

And I'd have to agree (that you are 100% exactly right!)

(Good eye!)

In task 2, parameter would be the right word, not argument.

They use parameter correctly in task 3, though.

My understanding is that it's (referred to as) a parameter when the function is declared (a variable).

And it's (referred to as) an argument when the function is called (a specific value).

More info:

https://blog.kotlin-academy.com/programmer-dictionary-parameter-vs-argument-type-parameter-vs-type-argument-b965d2cc6929

I hope that helps.

Stay safe and happy coding!

Hi!

No - think the directions are correct.

They were asking for this:

function returnValue(value) {
    return value;
}

A curious thing though, this would NOT pass:

const returnValue = function(value) {
    return value;
}

I get:

Bummer: The function declaration doesn't have a parameter named 'value', which is obviously NOT true!?!

Even though that's a perfectly acceptable way to code it.

Also this passes:

const returnValue = (value) => { return value };

But this does NOT:

const returnValue = value => value;

Again, I get:

Bummer: The function declaration doesn't have a parameter named 'value', which is aslo obviously NOT true!?!

The tests can be a bit temperamental!?! LOL

I hope that helps.

Stay safe and happy coding!

Ok so this is the original code i placed below wish worked fine. But what I'm saying Is the section of where value is. Is a parameter not an argument. So should the task say please place value in a parameter so arguments can later be passed into the function later on or something of those words.

function returnValue(value) {

}

Ok thank goodness I wanted to make sure I understood the difference between the two. The sentence kinda threw me off there. Im like wait isn't that a parameter. Maybe I should get a special badge for task sentence correction lol. Thanks this article helps alot.

BTW, I tell everyone this...

If you have seen Resident Alien on the Sci-Fichannel, it's GENIUS - absolutely brilliant!?! SOOOOOOOO funny!?!

More info:

https://www.syfy.com/syfywire/syfy-renews-resident-alien-for-season-2

:D