Splice: Adds (3 arguments) or deletes (2 arguments) or replaces (3 arguments) data to the array, and returns the deleted items. This will change the array push unshift POP Shift will affect the array array.splice(index,homeany,item1) has three arguments,
Delete: array.splice(index,number) starting position,number of items to delete First parameter: required, specify the position to add, delete, or replace, indicating that the index is deleted from a number. The second argument: not required, indicating the number of deletions. If the value is set to 0, no deletion is required.
Splice (index,number,eachItem) start position,number of items to be deleted, item to be inserted (there is no limit to the number of items to be inserted), add from the beginning of the start index.Returns the added whole array
Replace: You can insert any number of items into a specified location and delete any number of items simultaneously by specifying three parameters: the start location, the number of items to delete, and any number of items to insert. The number of inserted items need not be equal to the number of deleted items. Returns the entire array after the replacement
Delete: Returns an array of deleted elements
A,Slice: interception
Returns the selected element from an existing array with two arguments representing the truncated start index and end index, respectively
Without a second argument, returns items from the start position to the end of the array.Returns the intercepted content
When slice() takes no arguments, it returns a new array of the same length as the original array by default. Slice does not affect the original array.
Second,The substring: interception
Intercepting a string with two arguments representing the start and end subscripts respectively. If the end index is larger than the start index, the method swaps two arguments before intercepting. You can’t start with a negative subscript. Returns the intercepted element
Three,Substr: interception
To truncate a string, two arguments represent the starting subscript and the length to truncate. The starting subscript can be negative, or if it is negative, it starts at the end of the string. For example, -1, from the end, if -2, from the penultimate character, and so on. If there is no length, the string is truncated to the end. Returns the intercepted element
The first argument is a negative number
In the example above, the truncation starts at the fourth from the bottom of the string and takes two bits