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 trialArne Saenger
687 PointsNot sure how to solve the challenge. Where can I see the solution?
Not sure how to solve the challenge. Where can I see the solution?
function max(argument1, argument2) {
if (argument1 > argument2) {
return argument1
} else {
return argument2 }
};
max(2,3);
alert(max);
1 Answer
andren
28,558 PointsThere isn't any official method of displaying the correct result, beyond asking for help here in the forums or Googling the name of the challenge, and looking at previous discussions of it.
As for your code, it's quite close. The challenge wants you to alert the result of calling the function. When you call a function the returned value is essentially placed wherever the call to the function occurred. Which means that to alert out the result you need to call the function within the call to the alert function. Like this:
function max(argument1, argument2) {
if (argument1 > argument2) {
return argument1
} else {
return argument2 }
};
alert(max(2,3));