Learn all about the jQuery function .map().
If you wish to process a plain array or object, use the jQuery.map() instead.
As the return value is a jQuery object, which contains an array, it’s very common to call
.get() on the result to work with a basic array.
.map() method is particularly useful for getting or setting the value of a collection of elements. Consider a form with a set of checkboxes in it:
To get a comma-separated list of checkbox
The result of this call is the string,
Within the callback function,
this refers to the current DOM element for each iteration. The function can return an individual data item or an array of data items to be inserted into the resulting set. If an array is returned, the elements inside the array are inserted into the set. If the function returns
undefined, no element will be inserted.