i got this code :
Object.defineProperty(Array.prototype, "remove", {
enumerable: false,
value: function (item) {
var removeCounter = 0;
for (var index = 0; index < this.length; index++) {
if (this[index] === item) {
this.splice(index, 1);
removeCounter++;
index--;
}
}
return removeCounter;
}
});
And i try to remove from array specific elements with this code line :
var itemsRemoved = finalArray.remove(getBack);
But if i do console.log() it return 0 elements removed while my variable getBack is equal with 0 or other number and in array getBack value exists.