Skip to content

Instantly share code, notes, and snippets.

@luislobo14rap
Created August 23, 2018 01:11
Show Gist options
  • Save luislobo14rap/78ebabe36354b71fa2181936feb176e8 to your computer and use it in GitHub Desktop.
Save luislobo14rap/78ebabe36354b71fa2181936feb176e8 to your computer and use it in GitHub Desktop.
// arrayRemove.js v1
function arrayRemove(arrayA, arrayB) {
newArray = [];
for (let i = 0; i < arrayA.length; i++) {
if (arrayB.indexOf(arrayA[i]) == -1) {
newArray.push(arrayA[i]);
};
};
return newArray;
};
Array.prototype.remove = function(arrayB) {
return arrayRemove(this, arrayB);
};
function arrayRemove(a,b){newArray=[];for(let c=0;c<a.length;c++)-1==b.indexOf(a[c])&&newArray.push(a[c]);return newArray}Array.prototype.remove=function(a){return arrayRemove(this,a)};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment