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

I really need help . I am stuck to add the Result in Javascript console .

I tried to add console.log in every way . I can not figure it out what is the problem , It takes long time .

script.js
function max (arg1,arg2){
  return 4+3;
}

 console.log( addNumbers(3,4) );  ///7

2 Answers

Hello, in the console.log method you are calling a function addNumbers, however, given the code snippet, the name of the function is max. I would try console.log(max(3, 4)). Also, I think the exercise is wanting you to arg1 and arg2 in the code that executed in the function itself and not just as parameters. return arg1 + arg2. This way the function could, in theory, take in what ever two numbers someone based to it. Hope this helps.

Thank you for getting back to me . I tried to return arg1+arg2 but it did work ,It only excepts 3 and 4 because these numbers are bigger than 1, 2. And console.log(max(3,4)) did not work either .

I just fixed it . Anyway I returned 3+4 . console.log worked as you told me .