Javascript Array where(_cond)

Description

Javascript Array where(_cond)

Array.prototype.where = function (_cond) {

    var items = []; 
    for (var l = 0; l < this.length; l++) {
        if (_cond(this[l])) {
            items.push(this[l]);/*from  w w  w .j  a  va2  s  . com*/
        }
    }
    return items;
};



PreviousNext

Related