Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
MOD
Mark Wilkowske
Treehouse Moderator 17,494 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 }

Mark Wilkowske
MOD
Mark Wilkowske
Treehouse Moderator 17,494 Points

Conditional Statements is the course level before this one.

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
216,057 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.