すべてでJS()およびいくつかの()使用
毎()およびいくつかの()メソッドは、反復法アレイJSあります。
()は指定された関数に、アレイ内の各アイテムで実行されるすべてのそれぞれについて、それがtrueを返す場合、この関数は真を返します。
いくつかは()関数のいずれかの配列で与えられる関数場合にtrueを返し、各アイテムで実行され、それは真を返します。
var arr = [ 1, 2, 3, 4, 5, 6 ];
console.log( arr.some( function( item, index, array ){
console.log( 'item=' + item + ',index='+index+',array='+array );
return item > 3;
}));
console.log( arr.every( function( item, index, array ){
console.log( 'item=' + item + ',index='+index+',array='+array );
return item > 3;
}));