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 trialJohn Odom
4,094 PointsAhoy Fellow Coders! I continuoslyn get a syntax error, despite multiple attempts. Can anyone spot my stupid mistake?
Still getting the hang of return values in functions... now I'm completely stumped
/*First Attempt*/
function max (1, 4) {
if (max>4) {
return 1;} else {
return 4;}
}
/*Second attempt*/
function max (1, 4) {
var x = 3;
if (max < x) {
return 1} else {
return 4}
}
2 Answers
Dale Severude
Full Stack JavaScript Techdegree Graduate 71,350 PointsHi John, First replace all your fixed numbers with variables, second max is the function name don't call it within a function.
function max (x, y) {
if (x>y) {
return x;} else {
return y;}
}
John Odom
4,094 PointsChampion! Thank you, Dale