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 Basics (Retired) Creating Reusable Code with Functions Review Creating Reusable Code with Functions

1 Answer

Sam Baines
Sam Baines
4,315 Points

Hi - the first screenshot shows you failing because you do not need to add the (;) semi-colon after the function name 'Warning' as this is already in place in the code. And the second screenshot, the answer is 'arguments' - as in you can pass the function one or more arguments, like in following:

randomNumber(upper, lower);

For the third and fourth screenshots - you need to 'return' the variable message i.e. in the space you need to put the return statement followed by the message variable.

shadryck
shadryck
12,151 Points

Ah yes, that makes perfectly sense, I missed it. Anyhow this doesn't work for greeting() nor greeting('name'). Any ideas?

EDIT - So tired I even totally missed your last sentence "For the third and fourth screenshots - you need to 'return' the variable message i.e. in the space you need to put the return statement followed by the message variable." Thats why I asked about the greeting()

Been coding for the whole day non-stop now.. Time to take a long break.

shadryck
shadryck
12,151 Points

Your reply got deleted Marcus Parsons, anyway thank you both for your time to point out the errors.

I deleted it. I believe Sam already had the correct answer, but that's no problem. I'll let him have the glory this time haha :P You're welcome, Vincent.

Sam Baines
Sam Baines
4,315 Points

Vincent that is because it is not asking you to call the greeting function (as technically your are already inside the function itself) the challenge is asking you to return the message variable like this:

function greeting( name ) {
var message = "Hello " + name ;
return message
}

I hadn't explained it well but thanks Marcus.

shadryck
shadryck
12,151 Points

See my first reply ~EDIT Thanks for trying to explain though.