map and forch
- Parameters: all(current value, current matching index, currently calling array)
- I can’t write everything
a map
- According to the transformation of each element, a new matrix is formed
- The original group has not changed.
- Return to a new group
Note the question written: See callback function
[1 "," 2 "," 3 "]. Map (parseint); // Результат [1, NAN, NAN]
for every
- Through the callback function, perform some operations on each element
- No return, not specified
- Poor performance, far from being directly usable, accessing each element with an index
filter and reduce
filter
- Through True / False of return, filter the elements of the array
- That’s right: reserve
- invalid: delete
- Finally, a new array is returned and the original array will not be modified
scale down
- Another option, a total of four
- Prevalue: The first parameter, returning from the previous element
- The last three parameters are the same as the other parameters
- Finally returns one value
Paste and slice
splicing (sewing)
- Used to remove + add
- Index: Kai started the remote index
- NUM: number of removes (0 not removed)
- To add an element, separate it with a comma; add to index center,
- Modify the original array and return the set of the deleted elements
slice (slice)
- Used to return specific items
- start: start pointer (the negative number is counted from the tail, -1 indicates the penultimate one) (do not write from start to end)
- end: index of the end (no default character for the end)
- Return a new matrix without changing the original matrix
От: https://www.wolai.com/mary/4d3HuSKg2c4K3CHnDDWkYt