Array comparative method

map: Returns a new array, the array does not change the original
filter: Returns a new array does not change the original array
forEach: just use the array elements

slice: selecting a portion of the array, and returns a new array slice (1, 3) slice (1) slice (1, -1)

indexOf: search elements in the array and returns its position in the
join: all the elements of the array into a string

Change the original array of
pop: Removes the last element, return the removed element
shift: removes the first element, the element returned delete
push unshift: returns the new length of the array
splice: insert delete instead of array.splice (index, howMany, item1, .... ., itemX) returns an array of elements to be deleted, changing the original array
reverse: reverse
sort: sorting

Guess you like

Origin www.cnblogs.com/bingery/p/11282959.html