Remove one value from array by predicate - Node.js Array

Node.js examples for Array:Remove Element

Description

Remove one value from array by predicate

Demo Code

Array.prototype.removeOneByPredicate = function (pr) {
    var index = this.indexOf(this.first(pr));
    if (index != -1) {
        this.splice(index, 1);// www  .  j  a va2  s . c  o m
        return true;
    }
};

Related Tutorials