Remove one element from array - Node.js Array

Node.js examples for Array:Remove Element

Description

Remove one element from array

Demo Code

Array.prototype.removeOne = function(value) {

    var index = this.indexOf(value);
    if (index !== -1) {
        this.splice(index, 1);/*from   w  w  w .  ja  v  a  2s  . c om*/
        return true;
    }
    return false;
};

Related Tutorials