Created
July 2, 2017 04:29
-
-
Save jorlee92/4237149de8c336c0f90f6de03d66d2d6 to your computer and use it in GitHub Desktop.
This file contains 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 destroyer(arr) { | |
// Remove all the values | |
res = Array.from(arr[0]); | |
for(var i = 1 ; i < arr.length; i++){ | |
res = res.filter(function(v){ | |
console.log(i); | |
console.log(v); | |
return v!=arr[i]; | |
}); | |
} | |
return res; | |
} | |
destroyer([1, 2, 3, 1, 2, 3], 2, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment