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 trialGilbert Torres
Front End Web Development Techdegree Student 2,479 PointsHello, My solution works on jsFiddle, but not on the challege question?
function max(fNum, sNum) { if (fNum > sNum) { return 'The first number ' + fNum + " " + "is the larger Number"; } else { return 'The second number ' + sNum + " " + "is the larger Number"; } } alert( max(5, 10) );
function max(fNum, sNum) {
if (fNum > sNum) {
return 'The first number ' + fNum + " " + "is the larger Number";
} else {
return 'The second number ' + sNum + " " + "is the larger Number";
}
}
alert( max(5, 10) );
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! You're doing great, but you've gone a little bit above and beyond what they asked for. Remember that challenges are very strict. The challenge asks you to return the largest of the two numbers. But what you're returning is a string containing the largest of the two numbers. To be fair, your output is prettier, but the challenge did not ask for a string to be returned.
Going forward it's important to try not to do anything the challenge doesn't explicitly ask for. Even if functional outside the challenge, it can cause the challenge to fail.
Hope this helps!
Gilbert Torres
Front End Web Development Techdegree Student 2,479 PointsGilbert Torres
Front End Web Development Techdegree Student 2,479 PointsThank you so much. I have spent at least 8 hours beating my head trying to solve this problem.
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherWe all get stuck! Don't worry. It just means you're human. When I get stuck on these, I go back and read the instructions word for word. Chances are often that I've missed some silly thing. I'm printing instead of returning... that sort of thing. Hang in there! You're doing just fine