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 trialMUZ140884 Maxwell Makumucha
6,291 Pointshow to call two arguments....
Underneath the max() function you just created, call it with two arguments and display the results in an alert dialog. You can pass the result of the function to the alert() method. For example, to display the results of the Math.random() method in an alert dialog you could type this:
function max(x, y) { if (x > y) { return x; } else { return y; } }
function max(x , y){
alert(x + "and" y );
}
1 Answer
Van Tran
Front End Web Development Techdegree Student 12,628 PointsI suppose that the max function should be called like:
function max(x, y) { if (x > y) { return x; } else { return y; } }
maxValue = max(5, 1); // Find the max value of 5 and 1
alert(maxValue); // alert the max value