A set of useful static methods to deal with arrays; provide missing methods for older browsers.(一系列有用的处理数组的静态方法,为老的浏览器提供了缺失的方法。)

 

 

every( Array array, Function fn, Object scope ) : Boolean

Executes the specified function for each array element until the function returns a falsy value.(直到方法返回了false值才会停止为每个数组的元素执行指定的方法) If such an item is found, the function will return false immediately.(如果这样一个元素被发现,方法将立即返回false值) Otherwise, it will return true.(否则的话它将会返回true。)

Parameters

    array : Array

    fn : Function

    Callback function for each item(为每个元素调用回调方法)

    scope : Object

    Callback function scope

Returns

    Boolean

    True if no false value is returned by the callback function.(如果没有回调方法返回false,结果是true)

 

 

 

filter( Array array, Function fn, Object scope ) : Array

Creates a new array with all of the elements of this array for which the provided filtering function returns true.(用这个提供的过滤方法返回true的所有数组元素创建一个新的数组,)

Parameters

    array : Array

    fn : Function

    Callback function for each item(为每个元素调用回调方法)

    scope : Object

    Callback function scope

Returns

    Array

    results