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?

Thanks

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

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

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) {
console.log(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”.

example

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