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 trial

JavaScript JavaScript Functions Pass Information Into Functions Create a max() Function

Frederik Dobbener
Frederik Dobbener
2,356 Points

What did i do wrong?

Can't quite figure out what i did wrong? Thanks for any help in advance

script.js
function max(numOne, numTwo){
    if (numOne > numeTwo) {
       return `${numOne}`;
    }
    else {
       return `${numTwo}`;
    }
}

2 Answers

Cameron Childres
Cameron Childres
11,820 Points

Hi Frederik,

Your very close, I just see two main issues.

First of all check the spelling on your variables -- the second line contains "numeTwo" instead of "numTwo".

Second, they want you to return a number and not a string. You've used backticks and string interpolation on your variables which will make them in to strings.

If you fix the spelling and remove `${}` from your return statements (leaving just the variable name) you should be good to go.

Hope this helps! Let me know if you have any questions.