One, every (), runs the given function for each item in the array, and returns True if the function returns true for each item.
var arr=[1,2,3,4,5,6,7,8,9];everyresult=arr.every (function(item,index,array) { return (item>2);
The result of execution is false;
var arr=[1,2,3,4,5,6,7,8,9];arr.foreach (function(item,index,array) { // perform certain Actions })
Two, filter (); Each item in an array runs the given function, and returns the list of items that the function returns True.
var Arr=[1,2,3,4,5,6,7,8,9];var filterresult=arr.filter (function (item,index,array) { return (item>2);}) Alert (Filterresult ());
Returns an array and each value in the array is greater than 2 [3,4,5,6,7,8,9];
Three, ForEach (); Runs the given function for each item in the array, and the method does not return a value; it is essentially the same as using a for loop to iterate over an algebraic group.
var arr=[1,2,3,4,5,6,7];arr.foreach (function(item,index,array) { // perform certain Actions })
Four, map, an array of each of the arrays that run the given function, nearly returning the result of each function call.
var arr=[1,2,3,4,5,6,7]; var mapresult=arr.map (function(item,index,array) { return item*2;}); Alert (Mapresult)
The value returned is; [2,3,6,8,10,12,14];
Five, some, runs the given function for each item in the array, and returns True if the function returns true for either item.
var arr=[1,2,3,4,5,6,7]; var someresult=arr.some (function(item,index,array) { return ( Item>2);}); alert (someresult);
The returned result is true;
Iterative methods for arrays