Filter () Determines whether an item contained in an array is returned by using the specified function.
var num = [1,2,3,4,5,6,12];
Num.filter (function (item, index, array) {
Return (item > 2); [3, 4, 5, 6, 12]
});
Map () returns an array in which each item runs the result of an incoming argument on a corresponding item in the original array
var num = [1,2,3,4,5,4,3,2,1];
Num.map (function (item, index, array) {
Return (item * 2); [2, 4, 6, 8, 10, 8, 6, 4, 2]
});
Every () some () to query whether an item in the array meets a condition every () the arguments that must be passed in each return true, and the result is the True;some () method
As long as one is true, the result is true
var num = [1,2,3,4,5,4,3,2,1];
Num.every (function (item, index, array) {
Return (item > 2); False
});
Num.some (function (item, index, array) {
Return (item > 2); True
})
ForEach () Incoming arguments for each entry in the array, no return value
var num = [1,2,3,4,5,4,3,2,1];
Num.foreach (function (item, index, array) {
return item;
})