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 trialBaheejah Fareed
3,450 PointsChallenge: create a max function Please help me to see what my syntax and parse errors are.
function max (arg1, arg2) { if (arg1 > arg2) { return arg1; } else if { return arg2; } max (7, 3);
function max (7, 3) {
if (7 > 3) {
return true;
} else if {
return false;
}
max (7, 3);
2 Answers
Steven Parker
231,275 PointsWhen you define a function, the parameters must have names, which cannot start with (or only be) digits.
And for a "max" function, the returns need to pass back one of the parameters, not just "true" or "false".
Also, the final "else" does not need an "if" after it.
Baheejah Fareed
3,450 PointsThank you so very much! I felt like I was experiencing something similar to Imposture Syndrome. Although I'm not a professional developer yet I felt like I understood things as I learned them, then this challenge gave me a huge brain freeze.