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 trialEugen Oanta
5,657 PointsI am lost
I don't understand the test:
Create a new function named max() which accepts two numbers as arguments. The function should return the larger of the two numbers. You'll need to use a conditional statement to test the 2 numbers to see which is the larger of the two.
function max(2, 5) {
var high === 5;
if (high)
}
4 Answers
Nicholas Dupuis
11,466 PointsUse your conditionals to check which one is larger, then return that.
So to see if a is bigger than b, you might want to do something like
if(a>b){
return a;
}
And then if b is larger than a, do something else.
Eugen Oanta
5,657 PointsThank You for the reply, it kinda bothers me still because I did not understand the principle of this test, and cannot see the result, I rewatched the return video and arguments but still don't get it, I will try several times maybe I get the logic of it, the whole RETURN thing. If not I just quit. :). If anyone can come with the solution please post it here. Thank you.
Clarissa Lao
Courses Plus Student 2,849 Pointsfunction max(a, b){ if(a>b){ return a; } else { return b;} } max(2, 6)
Eugen Oanta
5,657 PointsThank You!