10 Passing variables: Review of Functions in JavaScript


#1

// 1. Declare two variables here and set them to 5 and 6:
var num1,num2= ;

var getMaxnum = function (n1, n2) {
if (n1 < n2) {
return n2;
}
else {
return n1;
}
};

// Change 10 and 11 to the variables you created
getMaxnum = 10,11;

I cant figure it out. Am I doing something wrong?


#2

You are missing a variable declaration and assigning a value to it.
Declare a variable and set it to 3:

var example = 3;

If you want to use function then remember how you defined a function:

var getMaxnum = function (n1,n2){
    //body
}

Here you assign value "10,11" to variable getMaxnum

getMaxnum = 10,11;

What you have to do is call out the function with the parameters.

//defining a function called testFunction with two parameters.
var testFunction(parameter1,parameter2){
    do something;
}
//Calling out the function, with two parameters
testFunction(parameter1,parameter2);