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 trialHarper Frankstone
5,156 PointsPassing numbers through a function
I can't seem to think of how to do this correctly at the moment. Anyone want to help?
Thanks!
function max('small', 'large') {
return large;
}
1 Answer
Jason Stanley
5,556 PointsYour function should have variables as parameters. You are using string literals as parameters which is not valid code. Try:
function max (small, large) {
Although in your case it is asking you to return the largest number. As a result you do not know which parameter is the largest without applying some logic. Instead something like
function max(num1, num2) {
// Insert logic here to return the larger number
}