Pre, if the array has not been operated on, pre is the first item in the array or the value of the init initialized. If an operation has been performed, pre is the value returned from the last operation.

Cur is the array element to be called, now 1, or 2 if there is no initial init value

Index index, arr is the array to operate on, init is the initial value

Let array = [1,2,3,4] array.reduce((x, y) => return x + y), []) arr. Reduce (function(prev,cur,index,arr){... some Code }, init);Copy the code

Split: replaces the value in the destination array with the same value as the passed parameter with “,” splits the string into an array of variable units if the parameter is empty, and replaces the space in the string with “,” if the parameter is blank.

const array = "hello,renhanhan,buluohe"
console.log(array.split("he"));
Copy the code

Join reassembles the target string into an array, inserts the pass parameter into the interval of the string, and reassembles it into a new string

const array = ['hello','buluohe']
console.log(array.join('---'));
Copy the code

Reverse reverses the arguments in the array and returns the original array

const array = 'hellobuluoherenhanhan'
console.log(array.split("").reverse());
Copy the code