Javascript Array hasWhere(property, value)

Description

Javascript Array hasWhere(property, value)

Array.prototype.hasWhere = function (property, value) {
    "use strict";

    for(var i = 0; i < this.length; i++) {
        if(this[i][property] === value) {
            return true;
        }/*from ww w.  j  a  v a  2s  . c  o m*/
    }

    return false;
};



PreviousNext

Related