Removes a specific object from the array - Node.js Array

Node.js examples for Array:Remove Element

Description

Removes a specific object from the array

Demo Code


/**/*from w w w.  j av  a  2  s.c  o m*/
    Removes a specific object from the array
    @param object The object to remove
*/
Array.prototype.removeObject = function(object)
{
    for (var i = 0; i < this.length; ++i)
    {
        if (this[i] === object)
        {
            this.remove(i);
            break;
        }
    }
}

Related Tutorials