Use jQuery to operate the implementation code of the object array. For more information, see. JQuery provides the following tools for array element operations:
(1) Examples of arrays and objects: jQuery. each (obj, callback)
The general example method can be used for example object and array. The callback function has two parameters: the first is the object's member or array index, and the second is the corresponding variable or content. If you want to exit the each loop, the callback function returns false. Other return values are ignored.
(2) filter array elements: jQuery. grep (array, callback, [invert])
Filter Array elements using the filter function. This function must pass at least two parameters: the array to be filtered and the filter function. The filter function must return true to retain the element or false to delete the element.
(3) Search for array elements: jQuery. inArray (value, array)
Determine the position of the first parameter in the array (-1 is returned if no value is found ).
(4) Delete duplicate elements: jQuery. unique (array)
Delete repeated elements in the array.
The following instances filter through the object array to obtain or delete the array elements with the specified attribute as the specified value.
The Code is as follows: