Created
September 12, 2015 13:16
-
-
Save ericcgu/d818341b1f63123340d5 to your computer and use it in GitHub Desktop.
destroyer
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 destroyer(arr) { | |
| var cleanArray = arguments[0]; | |
| for (var i = 1; i < arguments.length; i ++){ | |
| cleanArray = without(cleanArray, arguments[i]); | |
| } | |
| return cleanArray; | |
| } | |
| function without(array, what){ | |
| return array.filter(function(el){ | |
| return el !== what; | |
| }); | |
| } | |
| 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