Function parameter listed

What is that case in this example

function test(test1,test2) {

When test parameter not used but is required to set before test2?


i believe ‘test’ is the name of the function? (not a parameter)

Can you try asking your question a little differently? For example, how is this function called and how are test1 and test2 used inside the function?

$menu.children().outerWidth(function(i, s) {
	test += s;
	test2 += 1;

I and S parameters used. But S is used on first test. The I is not used but if remove the whole is not working. What the logic on this?

Is there any reason that you must remove i?

NO! But from copy paste I know nothing about it. So that I must be something undefinied there because if not not working. But what logic hmm???

let’s say, function test look like this

function test(test1, test2) {

when you declare function with name test, you make it with paramater call test1 and test2.

function test(test1,test2)

test1 and test2 is the paramater you should give when you call that function “test”.


test(10, ‘foo’);

and then, variabel test1 will have value = 10, and variabel test2 will have value = ‘foo’.
the result will display ‘foo’ message on console. because it take value of test2

but if you try to call test function without paramater, you will get error message.

hope this will help

By reading the jquery doc about outerWidth function you will understand what the two parameters mean.

1 Like