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

Mihai Childesco
Mihai Childesco
9,326 Points

function myFunction (parameter1, parameter2) {} myFunction(argument1, argument2). Is this the def param and args?

I don't understand question. How could I measure which parameters are larger of the two? The question shouldn't be - Which of the argument is larger?

script.js
function max(number1, number2) {

}

3 Answers

Steven Parker
Steven Parker
231,236 Points

Normally parameter refers to the definition, and argument refers to the usage.

A parameter is a variable in a method definition. When a method is called, the arguments are the data you pass into the method's parameters.

So yes, the challenge probably should say, "...test the 2 arguments to see which is the larger of the two."

You may want to report this as a bug to Support.

Tim Acker
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Tim Acker
Front End Web Development Techdegree Graduate 31,247 Points

Hello, you are being asked to add a conditional statement to this function so that it can perform the comparison like so:

if (number1 > number2) {
    return number1;
} else {
    return number2;
}
Mihai Childesco
Mihai Childesco
9,326 Points

thanks for answering. I understand how to resolve the exercise but the question seems to be weird to me because I compare the arguments not the parameters.