Javascript Array removeWhere(property, value)

Description

Javascript Array removeWhere(property, value)


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

    for(var i = 0; i < this.length; i++) {
        if(this[i][property] === value) {
            this.splice(i, 1);//from  w ww .  j ava  2 s. c  om

            break;
        }
    }
};



PreviousNext

Related