var t = [1,2,3,4,5];
Some does not continue after it finds the first qualifying value in the array
Used to determine if the values in the array meet the requirements, and return the result True|false
function return type is BOOL
var some = T.some (function (item) {if (item% 2 = = = 0) {return true;} else{return false;}});
Console.log (some);
Every matches every element until there is a return of false
function return type is Boolean
var every = T.every (function (item) {if (item% 2!== 0) {return true;} else{Console.log (item); return false;});
Console.log (every);
Map handles all values in the array and returns the processed value without affecting the original array, returning the result to the new array
function return type of item
var map = T.map (function (item) {return item + 1;});
Console.log (map);
Filter array element Filters, returns true to the collection into a new array, returns the result as a new array
function return type is BOOL
var filter = T.filter (function (item) {if (item% 2 = = = 0) {return true;} else{return false;}});
Console.log (filter);
Console.log ('------------------------');
Async.eachlimit (t, 2, function (item, CB) {
Console.log ("Each limit item=" + item);
CB ();
}, function (err) {
Console.log ("End .....");
});
Async.map (t, function (item, CB) {
Console.log ("Map item =" + Item);
CB ();
}, function (err) {
Console.log ("End ...");
});
Async.maplimit (t, 2, function (item, CB) {
Console.log ("Map Limit item =" + Item);
CB ();
}, function (err) {
Console.log ("End ...");
});
Async.filter (t, function (item, CB) {
if (item% 2 = = = 0) {
CB (TRUE);
}else{
CB (FALSE);
}
}, function (Result) {
Console.log (result);
});
Some,every,map,filter in JavaScript is used only with Each,eachlimit,map,maplimit,filter in ANSYC