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 trialTrue Andrews
Front End Web Development Techdegree Student 10,520 PointsWhat am I missing? I've tried many combinations.
function max( 10, 5 ) {
if ( 10 > 5 ) {
return 10;
} else {
return 5;
}
2 Answers
Steven Parker
231,236 PointsFunction parameters must be names, not numbers. Just replace all the instances of each number with name.
And you also need an additional closing brace at the end to balance the one that begins the function body block.
For example, if you call the first parameter "a", and the second one "b":
function max( a, b ) {
if ( a > b ) {
return a;
} else {
return b;
}
}
Unsubscribed User
15,201 PointsThe challenge wants you to make a function passing two variables that return the one with the highest value.
Try to change the numbers in variables names, like this.
function max(number_one, number_two) {
if (variable_one > variable_two) {
return number_one;
} else {
return number_two;
}
}