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

ALBERT VASQUEZ
PLUS
ALBERT VASQUEZ
Courses Plus Student 246 Points

Hey guys thanks for your time, I've got my function down I can't seem to figure out how to add the next steps correctly

function Max(num1, num2) {

if(num1 > num2) { return num1; } else { return num2; } } var Max (5

script.js
function Max(num1, num2)
{

  if(num1 > num2)
  {
    return num1;
  }
  else 
  {
    return num2;
  }
}
 var  Max (55,25);

2 Answers

The function itself is fine, but call it max, not Max

also, don't say var max() when you call it, simply use max()

Steven Parker
Steven Parker
231,248 Points

Here's a few hints:

  • task 1 asked for a function named "max" (all lower case)
  • task 2 asks "Display the result of the function in the browser's JavaScript console."
  • the "console.log()" function is for displaying on the console