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 trialAli Corlett
Courses Plus Student 1,359 Pointsbeneath max function add a 'call' in alert format.
I run this and I get, now No1 isn't passing. I go back. I change nothing, No1 passes. I am calling the function called 'max' and it has the two "numbers a, b". I really don't understand why the alert isn't showing a result as 'a'.
It is outside code block. It doesn't need an end brace. I think it should call function max and display 'a' as being more than b.
I am totally dumbfounded. Can you help?
function max (a, b) {
if (a > b) {
return a;
} else { return b; }
}
alert( max (a,b) );
2 Answers
af09
10,704 Points//Just pass numbers when you call the function and should be work fine. Something like this:
alert( max (3,5) );
Ali Corlett
Courses Plus Student 1,359 PointsThanks so much. I was confused by the video that said alphas could be used and sorted in order like a number. This worked. thanks.