The problem with the value passed by the $.each () callback function.

newcomers have a vague understanding.
Javascript and Jquery all return values.
such as $.each () returns an index and the value of that index.

$.each([52, 97], function(index, value) {
  alert(index + ": " + value);
});

I later used a function, that is called by each iteration, which has two virtual parameters index,value
whether function must have two parameters, even if I do not need to go to one of them (for example, I only need the returned value instead of using the index of that value), I have to write two parameters. Are the
parameters returned sequentially?
is the parameter I can write as function (a), a b is the index, and b is the value of the index. It doesn"t matter the name, the key is the location?
or I will write which parameter I use. I don"t have to write all the parameters.

Thank you for taking the time to read my question. Thank you.

Mar.18,2021

has two parameters. It doesn't matter how many names you use, but the key is location.


you're right, it doesn't matter the name, the key is location


if you only need an index, all you have to do is write one parameter, not both. Jquery will put it into the function in order according to the number of parameters you fill in, which can be written as:
$.each (Array, function (index) {

})

if you only want the value parameter, write both, which can be written as:
$.each (Array, function (index,value) {

})

does not write which parameter is used, the position is the decisive factor


Thank you for the invitation.

$.each([52, 97], function(index, value) {
  alert(index + ': ' + value);
});

the function you define is a callback function, which is finally called by each every time it traverses.
that is to say, the anonymous function you write is a function definition, where index,value is a formal parameter. When the callback function is executed (two arguments are passed into the), each when it is called internally by each;
the first argument represents the traversed index, and the second represents the traversed value

.

reference:
https://github.com/jquery/jqu.

clipboard.png
what it looks like in the jquery implementation.


is it okay to write

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38510-2c0f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38510-2c0f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?