Node.js examples for Array:Remove Element
Removes the first occurrence of the given element from the list.
/**/*from w w w .jav a 2s . co m*/ * Removes the first occurrence of the given element from the list. * * @param element the element to remove. * @return whether the operation was successfull or not. */ Array.prototype.remove = function(element) { for(var i=0; i<this.length; i++) { if(this[i] === element) { this.splice(i,1); return true; } } return false; }