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 trialNick Rocha
7,876 PointsUsing a function with a conditional
Can you check my conditional statement to call the function?
function max (number1, number2){
return number1;
if (number1 >= number2){
}
}
max(24,32);
1 Answer
Dave Harker
Courses Plus Student 15,510 PointsHi Nick Rocha,
Just taking a look at the code ... you've got the right idea just missing a couple of things.
I've popped in some comments to help you out.
function max (number1, number2){
return number1; // should be in the if block
if (number1 >= number2){
// return number1 here instead
}
// when will number2 return if it's larger ?
}
max(24,32);
You're doing great! keep at it!
Kind regards,
Dave