From overflow.site/questions/14237 / ... :
Array.prototype.remove= function(){ var what, a= arguments, L= a.length, ax; while(L && this.length){ what= a[--L]; while((ax= this.indexOf(what))!= -1){ this.splice(ax, 1); } } return this; } var ary = ['three', 'seven', 'eleven']; ary.remove('seven')
or by making it a global function:
function removeA(arr){ var what, a= arguments, L= a.length, ax; while(L> 1 && arr.length){ what= a[--L]; while((ax= arr.indexOf(what))!= -1){ arr.splice(ax, 1); } } return arr; } var ary= ['three','seven','eleven']; removeA(ary,'seven')
You need to make the function yourself. You can either iterate over the array, or delete an element, or execute this function for you. In any case, this is not a standard JS feature.
Hidde
source share