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 trialbrayant benitez
7,885 Pointserror on this lesson
I keep getting an error but i cant seem to figure out where i am going wrong.
function max(1, 2) { if(1 > 2) { return 1; } else { return 2; } }
alert(max(1, 2));
function max(1, 2) {
if(1 > 2) {
return 1;
} else {
return 2;
}
}
alert(max(1, 2));
1 Answer
Alexander Davison
65,469 PointsParameter names can't start with a number and also can't be a number itself.
Try changing the parameter names to a different one like "a" and "b".
function max(a, b) {
if (a > b) {
return a;
} else {
return b;
}
}
alert(max(1, 2));
Good luck! ~alex
brayant benitez
7,885 Pointsbrayant benitez
7,885 Pointswow thank you so much this works, now i understand this a little more
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsI'm happy to help :)