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 trialMarc Christiansen
1,744 PointsTask makes no sense to me
don´t get what it wants me to do?
function max (num1, num2) {
return Math.max( num1 + num2);
}
max(2, 7)
2 Answers
Jonathan Grieve
Treehouse Moderator 91,253 PointsThe first thing that you're missing is that it wants you to test what the maximum of the numbers should be by using an if
condition statement.
Secondly, you're trying to use the max()
method when all it wants is a function called max
, which you've successfully defined.
function max (num1, num2) {
}
So next provide a way for JavaScript to check which number when called is the largest of the 2 numbers... the way to do that is with a condition statement.
Simply return a reference to those variables .e.g. return num1
Marc Christiansen
1,744 PointsI still don´t understand the task.
But i made it work now.
Thank you :-)