Will change their approach
Array.copywithin (target, start [, end = this.length])
Start and end are allowed to be negative values for (compatibility issues) substitution operations in arrays.array.fill(value [,statrt = 0[, end = this.length]])
Replaces the values of all elements of the specified range in the array with value. Start and end are allowed to be negative values.array.pop()
Removes the last element of an array and returns the element.array.shift()
Removes the first element of the array and returns it.array.push()
Adds one or more elements to the end of the array and returns the new length of the array.array.unshift()
Inserts one or more elements at the beginning of an array and returns the new array length.array.reverse()
Invert the positions of elements in an array so that the first element becomes the last.array.sort([function(a, b)])
Sort the elements of an array in place and return the array.array.splice(start, deleteCount[, item1[, item2...])
Add or remove any element from an array at any location, return the array of the deleted elements, or return an empty array.
They don’t change their ways
array.concat(value1, value2.....)
Merges the passed array or non-array value with the original array to form a new array and returns it.array.includes(searchElement, [, fromIndex])
Used to determine whether the current array contains a specified value. Returns a Boolean value.array.join([separator = ','])
Separator concatenates all elements in an array into a string (the default separator is comma; if separator is an empty string, all elements in the array are concatenated). If separator is undefined or null, it is converted to an empty string.array.slice([begin = 0 [, end = this.length - 1]])
Stores a shallow copy of part of the array into a new array object and returns the new array.array.toString()
Returns a string composed of the return values of toString() for each element in the array, joined (separated by commas) by the call to join().array.toLocaleString()
Returns a string representing the elements in the array. The elements in the array are converted to strings using their respective toLocaleString methods, which are separated by a locale-specific string (such as a comma).array.indexOf(searchElement[, fromIndex = 0])
Returns the first index of the specified element that can be found in the array, otherwise -1.array.lastIndexOf(searchElement[, fromIndex = arr.length - 1])
Returns the last index of the specified element in the array, or -1 if none exists. Look through the back of the array.
Array traversal method
-
Array.foreach ((v, I, a) => {}) causes each line of the array to execute the given function once (v is the current value, I is the current index, and a is the array itself).
-
Array.entries () returns an array Iterator containing the key-value pairs for each index in the array.
-
Array.every (callback(v, I, a){})callback will only be called for indexes that have already been assigned, not indexes that have been deleted or never assigned (returns a Boolean value, i.e. the logical & operation on the result of each element callback function).
-
Array.some () is used in the same way as arr.evety(). (the results of each element of the callback function as a logical | | operation).
-
Array.filter ((v, I, a) => {}) tests all elements with the specified function and creates a new array containing all tested elements. (The callback function returns a Boolean value, true, and passes the test. Callback will only be called on indexes that have been assigned, not indexes that have been deleted or never assigned.)
-
Array.find ((v, I, a) =>{}) Currently has compatibility problems. Returns the first element in the array that meets the test condition, or undefined if none exists.
-
Array.keys () returns an iterator to the array index (similar to the arr.entries() method).
-
Array.map ((v, I, a) => {}) returns a new array consisting of the value returned by each element in the original array after calling a specified method. Map does not modify the original array that calls itself (although it can change the original array during callback execution).
-
Array.reduce (callback[, initialValue]) This method receives a function as an accumulator, and each value in the array (from left to right) is merged to a single value.
PreviousValue: the value returned from the last callback call, or the initialValue provided. CurrentValue: The current element in the array index: index array: If initialValue is provided when reducing is called, then the first previousValue is equal to initialValue and currentValue is equal to the first value in the array; If initialValue is not provided, previousValue is equal to the first value in the array, and currentValue is equal to the second value in the array.Copy the code
-
Array.reduceright () is used in the same way as array.reduce() and executed in the opposite direction.