Remove one value from array - Node.js Array

Node.js examples for Array:Remove Element

Description

Remove one value from array

Demo Code


Array.prototype.removeOneValue = function( v ) {
    for ( var i = this.length; i--; ) {
        if ( this[ i ] === v ) {
            return ( this.splice( i, 1 ) );
        }/*from  w w  w .ja  va 2  s  .c  om*/
    }
};

Related Tutorials