The 1.forEach method is used to invoke each element of an array and pass the element to a callback function.
Array.foreach (function (Currentvalue,index,arr), thisvalue);
1.currentValue must be. The current element.
2.index is optional. The index value of the current element.
3.arr is optional. The array object that corresponds to the current element
4.thisValue is optional. The value passed to the function is generally used with this value, and if this argument is null, "undefined" is passed to the "this" value
The 2.map () method returns a new array in which the elements of the array call the function-processed values for the original array element.
Array.map (function (Currentvalue,index,arr), Thisvalue)
1.currentValue must be, the value of the current element
2.index is optional. The index value of the current element
3.arr is optional. The array object to which the current element is subordinate
4.thisValue is optional. object is used as the execution callback. Passed to the function as the "this" value. If this parameter is empty, "undefined" is passed to the "this" value
3.thereduce method receives a function as an accumulator, and each value in the array begins to shrink and is finally computed as a value
Array.reduce (function (Total,currentvalue,currentindex,arr), initialvalue);
1.total must be. The return value after the initial value or the result of the calculation
2.currentValue must be, current element.
3.currentIndex is optional. Index of the current element
4.arr is optional. The array object to which the current element belongs
5.initialValue is optional. The initial value passed to the function
JS array of higher order functions commonly used methods foreach, map, reduce