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 trialronredmond
1,293 PointsI don't know why I am getting an error here.
The error says "Oops! It looks like Task 1 is no longer passing." The error message doesn't make sense to me. I completed the first part of the challenge OK and nothing in the first part has changed. Does anyone have know what's wrong here? Thanks.
function max(arg1, arg2) {
if (arg1 > arg2) {
return arg1;
} else {
return arg2;
}
}
max (4, 7);
alert (return() );
1 Answer
jason chan
31,009 Pointsfunction max (arg1, arg2) {
if(arg1 > arg2) {
return arg1;}
if(arg2 > arg1) {
return arg2;
}
}
// call the function
alert(Math.random(max(1,2)));
First your create function that accepts two arguments (inputs). Then you create if statements. If this is true return that number. But I used greater than.
the second part you going to call the function in alert, math.random, max function. Your supposed to put the function in the function. Pretend it's math.