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 trialRobert Rydlewski
3,828 PointsWhat'sc wrong with this code ??? I created the function, I made the argument of (4,9) inside the function and made ..
and made the conditional statement. What I missing ??? Please help
function max(x,y) {
return max(4,9)
if (x < y ) {
document.write("x is bigger then y");
}
else {
document.write("x is smaller then y");
}
2 Answers
Piotr Manczak
Front End Web Development Techdegree Graduate 29,363 Pointsfunction max(a, b) {
if (a>b) {
return a;
} else if (b>a) {
return b;
}
}
Robert Rydlewski
3,828 PointsThanks, guys :) I appreciate your help
Martin Lewis
12,166 PointsMartin Lewis
12,166 PointsHi Robert there a couple of issues with the code that has been written. Where you have called the function, this will not work, the function needs to be called outside of the function. Also try calling it without the return as well.
Hope this helped.