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 trialJason Kang
2,749 PointsAfter your newly created returnValue function, create a new variable named echo. (Need help with this challenge task)
Instructions: 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.
What am I doing wrong?
function returnValue(string){
var echo = 'returnValue('string')';
return string
}
<!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>
11 Answers
miikis
44,957 PointsHey Jason,
This is how it should look:
function returnValue(ferociousAnimal) {
return ferociousAnimal;
}
var echo = returnValue('Red Fox');
You were supposed to create a new variable called echo after the function. If it's still not clear, feel free to ask again.
Joseph Torres
6,282 PointsI think this was a dumb challenge!!!
Kalle Jungstedt
4,709 PointsIs it just me? I cruised thru Html and Css so far....but JS keeps me on my heels. No matter how much a practice every task fells like I´m going in to a test that I haven´t prepared for at all. I do stuff i answer the questions almost alway correct but when it comes to creating some code on my own....I feel completely lost most of the times.
Need some encouragement here! :I will it ever feel easier at all?
Alan McClenaghan
Full Stack JavaScript Techdegree Graduate 56,501 PointsI feel your pain. Since I started to learn web development, I've discovered that HTML and CSS are just the tip of the iceberg. Every time I feel like I've understood an aspect of JavaScript, it turns out there's even more to learn about it, like another peak to climb.
Kalle Jungstedt
4,709 Pointsdo you have any suggestions on how to go about it? I have started over my JS course 2 times but feel just the slightest improvement. And I get stuck at the same place anyway...
By learning Html and Css here I know they structure everything really well here... but feel like I just don´t get it...and it puts me down to start over and feel basically no improvement when I get back to where I was when I decided to start over, to "get it"... :/
Alan McClenaghan
Full Stack JavaScript Techdegree Graduate 56,501 PointsHi Kalle, I note from your profile that you've been a user since the end of August this year. A little over 2 months. That's not long for such an in-depth subject. I've been over the JavaScript material several times and I keep picking up new things all the time and I'm still far from confident about using it. It's a bit like learning a foreign language in that not only do you have to learn the syntax and grammar but you also have to use it regularly to develop the ability. You can't expect to write a great work of literature straight away. Copying out code can only get you so far. You need to be creating your own material. It was a foreign language you'd start off with a sentence or two before building up to more challenging material.
Some things I struggled to grasp the first few times: Different methods for accessing data in arrays and objects Passing data into functions (as above) and getting it out again.
Try posting a similar question directly to the Community and see if someone wiser and more experienced than me can offer you some wisdom. I'd be interested in reading about that too!
Lindsy BERNARDO
4,666 Pointsmy answer:
function returnValue(online) { return online; } var echo = returnValue( 'up' ); returnValue( '' );
Rafal Kita
5,496 PointsSimilar to the answers above. Here's my version - though I have to admit it took some time before I figured it out on my own.
function returnValue(abc) { return abc; } var echo = returnValue('alphabet');
Chuck D
1,094 PointsI dont understand how everything is related. what is the reason for the repetition? I dont even know what question to ask. :(
Noah Yemane
1,019 Pointsu suck torres
yarik kes
4,364 Pointsu suck too noah
Nicholas Wallen
12,278 PointsI don't understand this. Does the string you pass somehow override the "ferocious animal" thing?
ian truong
4,685 Pointsi may not the best person to explain this but ill give it a try. example: function returnValue(). returValue is like a variable in terms of naming. u can call it anything you want 'preferable related to the subject'. inside the parameter, again its like a value or varible u can put any name u want. think of the parameter as a empty canvas. infact lets call it returnValue(emptyCanvas). when u return the emptyCanvas you can put a picture of anything you want in it. console.log(returnValue("landscape"));
correct me if i am wrong. i am trying to understand and learn this myself.
Tomáš Komprs
14,057 PointsThis was really bad challenge..Thanks for help
ferdinand reusora
Courses Plus Student 2,780 Pointsthnx this post hehe. i tried it and it works :)
rachaelallison
9,521 Pointsrachaelallison
9,521 PointsI don't quite understand how the value of returnValue became 'Red Fox'. How did that get introduced?
miikis
44,957 Pointsmiikis
44,957 PointsHey Rachael,
The value 'Red Fox' is arbitrary; it could have been any thing else — like 'asdfsf' — and it would still work. That is, the value of echo would still be whatever was passed to the returnValue() function. Did that answer your question?
Alan McClenaghan
Full Stack JavaScript Techdegree Graduate 56,501 PointsAlan McClenaghan
Full Stack JavaScript Techdegree Graduate 56,501 PointsGreat example Makis. If the instructions for the challenge had been this logical rather than just "you can name it anything", I might have been able to see the connection with what they were trying to do and get there without looking for help. Thanks.
Kingsley Felix
8,591 PointsKingsley Felix
8,591 PointsThanks
Unsubscribed User
5,809 PointsUnsubscribed User
5,809 PointsThank you, i've been stuck one hour with it, now it make sense :)
rufus smith
3,147 Pointsrufus smith
3,147 PointsThanks, Mikis, this was very helpful!