Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Vince Leung
4,730 PointsJavascript function not working.
I can't seem to get my simple function code to work. Am i missing something?
function returnValue(math){
var addition = math + 10;
return addition;
}
console.log( returnValue (12) );

Vince Leung
4,730 PointsThanks Ashish. Maybe has to do with spacing or formating of my code, i heard treehouse challenges has to have a specific formating an order for your code to pass.
In terms of my code, i keep getting this message " Bummer! Make sure you return the argument that's passed into the function. In other words type return
, a space, and the parameter name."

Ashish Mehra
Courses Plus Student 340 Pointscan u please paste the link of challenge

Vince Leung
4,730 PointsI'm not 100% sure if this is going to work but: https://teamtreehouse.com/library/javascript-basics/creating-reusable-code-with-functions/passing-an-argument-to-a-function
If not, it is called "Challenge Task 1 of 2" under javascript basics

Vince Leung
4,730 PointsGreat! appreciate it, maybe i just made the challenge little too complicated LOL
Thanks Ashish appreciate it!
Vince

Ashish Mehra
Courses Plus Student 340 Pointsyour welcome and happy coding
1 Answer

Ashish Mehra
Courses Plus Student 340 Pointstry this it will work as u only need to do these thing in challenge
function returnValue(math){
return math;
}
var echo = returnValue("Hy");

rydavim
18,786 PointsI've changed your comment to an answer so that it may be voted on or marked as best answer.
Ashish Mehra
Courses Plus Student 340 PointsAshish Mehra
Courses Plus Student 340 PointsHey vince I run your code in my system as well as in browser console and i found it is working. I got 22 as a return value in console