Javascript Array remove(v)
// http://stackoverflow.com/questions/3396088/how-do-i-remove-an-object-from-an-array-with-javascript Array.prototype.remove = function(v) { let idx = -1;/* w w w .j a va2s . co m*/ if ((idx = this.indexOf(v)) != -1) { this.splice(idx, 1); return true; } return false; }
Array.prototype.remove = function(v) {
this.splice(this.indexOf(v) == -1 ? this.length : this.indexOf(v), 1);
}