Javascript Array setWhere(property, value, setProperty, setValue)

Description

Javascript Array setWhere(property, value, setProperty, setValue)

Array.prototype.setWhere = function (property, value, setProperty, setValue) {
    "use strict";

    for(var i = 0; i < this.length; i++) {
        if(this[i][property] === value) {
            this[i][setProperty] = setValue;

            return;
        }//from   www . j a v  a  2 s .  c  om
    }
};



PreviousNext

Related