Javascript Array SelectFirst(func)

Description

Javascript Array SelectFirst(func)


Array.prototype.SelectFirst = function (func) {
    var result = null;
    this.forEach(function (item) {
        if (func(item)) {
            result = item;//  ww w  .  j a va2  s . co  m
            return;
        }
    });
    return result;
};



PreviousNext

Related