-
-
Save eddyruiz/25ea183d364634f229cea077006718c2 to your computer and use it in GitHub Desktop.
A saved mob programming session with Learn Teach Code!
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
// CHALLENGE: https://www.freecodecamp.org/challenges/seek-and-destroy | |
/* | |
GOAL: Remove all elements from the initial array that | |
are of the same value as these arguments. | |
*/ | |
// EXAMPLE TEST: | |
// destroyer([1, 2, 3, 1, 2, 3], 2, 3) should return [1, 1] | |
function destroyer(arr) { | |
// STEP 1: Access other arguments with arguments obj | |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments | |
// CHECK EVERY ARGUMENT, EXCEPT THE FIRST ONE | |
for (var i = 1; i < arguments.length; i++) { | |
// is it inside the array? | |
// if it matches . | |
} | |
// Remove all the values | |
return arr; | |
} | |
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