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 Basics (Retired) Creating Reusable Code with Functions Create a max() Function

No idea what to do here...

Not sure what to do here... I created the function, but not sure how to call it using a conditional statement. Also not sure if I named it correctly for a number...or if I need to use "parseInt"

script.js
function max(number1, number2) {
}

2 Answers

Mark Wilkowske
PLUS
Mark Wilkowske
Courses Plus Student 18,131 Points

The task asks you to compare the passed in arguments using a conditional statement. Inside the curly braces is where that is done.

Thanks but how do I phrase the conditional statement, would it be something like this? ex: function max(number1, number2) { if return }

I'm aware of that. Just trying to get some quick help so I can continue this course without having to backtrack through a bunch of videos.

Steven Parker
Steven Parker
231,275 Points

Being able to comfortably create this kind of comparison logic will be important to your continued learning. It's worth taking a bit of time now to review it before you continue.