Created
August 23, 2018 01:11
-
-
Save luislobo14rap/78ebabe36354b71fa2181936feb176e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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