js basics-common array object methods (1)

1. Add an element unshift()
before the array 2. Add an element push() after the array
3. Combine the array concat()
4. Delete an element before the array shift()
5. Delete an element after the array pop()
6. Specify the array interception The position element returns a new array slice(start,end)
7. The array adds a new element at the specified position to change the original array splice(index,0,item) to
replace the splice(index,1,item)
8.The array deletes the element to change the original array splice (index,howMany)
9, find the position where the element first appears in the array indexOf()
10, find the position of the last occurrence of the element in the array lastIndexOf()
11, sort sort()
12, reverse the order of the array reverses()
13 、Judge whether it is an array isArray()
14. Array to string join()
15. Copy elements from a specified position in the array to another specified position in the array copyWithin(target, start, end)
16. Fill() Use a fixed Value to fill the array array.fill(value, start, end) to change the original array

Guess you like

Origin blog.csdn.net/qq_40969782/article/details/115250406