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 trialdavid Ramirez
Courses Plus Student 2,798 Pointsidk what i am doing
please
function max(parameter1 , parameter2){
return parameter1 + parameter2;
}
2 Answers
Julian Gutierrez
19,201 PointsYou need to return the larger of the two numbers, in this example you need to use an if/else statement inside of the function to accomplish this.
nulled
1,890 PointsYou're close. Go step by step of what the task asks you to do.
We must create a function named max that takes in two arguments:
function max (parameter1, parameter2) {
}
The function should then return the larger number of those two numbers. It notes we must use a conditional statement. If-else is a conditional statement.
So we are doing a simple comparing of the two numbers to determine which one is greater. We do that by using a > or < operators. So here we have it:
function max(parameter1, parameter2) {
if (parameter1 > parameter2) {
return parameter1;
} else {
return parameter2;
}
}