1 Creation of arrays
var arrayobj = new Array (); Create an array
var arrayobj = new Array ([size]); Create an array and specify the length, note not the upper limit, is the length
2 loops for an array
$.each (Object,fucntion (Num,item) {
alert (num);//array subscript
alert (item);//array element value
}
3 array element manipulation
Arrayobj. Push ([Item1 [item2] [... [Itemn]]); /Adds one or more new elements to the end of the array and returns the new length of the array
Arrayobj.unshift ([Item1 [item2 [...] [Itemn]]); /Adds one or more new elements to the beginning of the array, the elements in the array are automatically moved back, returning the new length of the array
Arrayobj.splice (insertpos,0,[item1[, item2[, ... [, Itemn]]]); /inserts one or more new elements into the specified position of the array, the element at the insertion position automatically moves back, and returns "".
Arrayobj.pop (); Removes the last element and returns the element value
Arrayobj.shift (); Removes the first element and returns the element value, and the elements in the array are automatically moved forward
Arrayobj.splice (Deletepos,deletecount); Removes the specified number of DeleteCount elements from the specified position deletepos, returning the removed element as an array
Arrayobj.slice (start, [end]); Returns a portion of the array as an array, noting that the element of end is not included, and if the end is omitted, all elements after start are copied
Arrayobj.concat ([item1[, item2[, ... [, Itemn]]]); Concatenate multiple arrays (which can also be strings, or a mixture of arrays and strings) into an array, returning a new, well-connected array
Arrayobj.slice (0); Returns a copy array of the array, note that it is a new array, not a pointer to the
Arrayobj.concat (); Returns a copy array of the array, note that it is a new array, not a pointer to the
4 array sorting
Arrayobj.reverse (); Reverses the element (the top row to the last and last to the top), returning the array address
Arrayobj.sort (); Sort the array elements, returning the address of the arrays
JSON data traversal {' key ': ' Value '}
$.each (data, function (k, v) {
Alert (k); Key value
Alert (v); Value values
});
jquery Arrays and dictionaries