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 trialLuke Joseph
5,749 PointsFunction, variable and argument question
Hi,
So this question in Passing an Argument to a function is quite confusing for me. It goes as follows:
After your newly created returnValue function, create a new variable named echo. Set the value of echo to be the results from calling the returnValue function. When you call the returnValue function, make sure to pass in any string you'd like for the parameter.
The function will accept the string you pass to it and return it back (using the return statement). Then your echo variable will be set with what is returned, the results.
My answer was:
function returnValue(money){
return money;
} document.write(returnValue(“20”)); var echo = returnValue(“20”);
I typed this and it never passed. I cannot really see what I did wrong. I tried experimenting certain ways and eventually passed the task but it was through trial and error I didn't really get the concept nor the answer coherently understood.
Thanks in advance,
1 Answer
T K
21,479 PointsHi Luke,
I copied your code into the challenge and it passed, however I did have to make a small change.
I'm not sure if it has something to do with the way the treehouse forum formatted your code... but I had to substitute: “ for " and the challenge passed!
It looks like you were using the wrong speech marks?
Tayler
Luke Joseph
5,749 PointsLuke Joseph
5,749 PointsThanks Tayler,
I don't think I would have found this because I'm using an unfamiliar german keyboard. Will have to try find the other speechmarks!
T K
21,479 PointsT K
21,479 PointsNo worried, glad to help!
I've never used a German keyboard, but if the shift+2 is giving you those weird speech marks I'd recommend switching your keyboard layout (in your operating system settings) to US/UK and see if that makes a difference. :)
Tayler