2018-10-08 17:34:43 +00:00
---
id: a39963a4c10bc8b4d4f06d7e
title: Seek and Destroy
isRequired: true
challengeType: 5
2018-10-10 20:20:40 +00:00
videoUrl: ''
localeTitle: Buscar y destruir
2018-10-08 17:34:43 +00:00
---
## Description
2018-10-10 20:20:40 +00:00
< section id = "description" > Se le proporcionará una matriz inicial (el primer argumento en la función del destructor), seguido de uno o más argumentos. Elimine todos los elementos de la matriz inicial que tengan el mismo valor que estos argumentos. < strong > Nota< / strong > < br > Tienes que usar el objeto < code > arguments< / code > . Recuerda usar < a href = "http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514" target = "_blank" > Read-Search-Ask< / a > si te atascas. Escribe tu propio código. < / section >
2018-10-08 17:34:43 +00:00
## Instructions
2018-10-10 20:20:40 +00:00
< section id = "instructions" >
2018-10-08 17:34:43 +00:00
< / section >
## Tests
< section id = 'tests' >
```yml
tests:
2018-10-10 20:20:40 +00:00
- text: '< code > destroyer([1, 2, 3, 1, 2, 3], 2, 3)</ code > debe devolver < code > [1, 1]</ code > .'
2018-10-08 17:34:43 +00:00
testString: 'assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], "< code > destroyer([1, 2, 3, 1, 2, 3], 2, 3)< / code > should return < code > [1, 1]< / code > .");'
2018-10-10 20:20:40 +00:00
- text: '< code > destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3)</ code > debe devolver < code > [1, 5, 1]</ code > .'
2018-10-08 17:34:43 +00:00
testString: 'assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], "< code > destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3)< / code > should return < code > [1, 5, 1]< / code > .");'
2018-10-10 20:20:40 +00:00
- text: '< code > destroyer([3, 5, 1, 2, 2], 2, 3, 5)</ code > debe devolver < code > [1]</ code > .'
2018-10-08 17:34:43 +00:00
testString: 'assert.deepEqual(destroyer([3, 5, 1, 2, 2], 2, 3, 5), [1], "< code > destroyer([3, 5, 1, 2, 2], 2, 3, 5)< / code > should return < code > [1]< / code > .");'
2018-10-10 20:20:40 +00:00
- text: '< code > destroyer([2, 3, 2, 3], 2, 3)</ code > debe devolver < code > []</ code > .'
2018-10-08 17:34:43 +00:00
testString: 'assert.deepEqual(destroyer([2, 3, 2, 3], 2, 3), [], "< code > destroyer([2, 3, 2, 3], 2, 3)< / code > should return < code > []< / code > .");'
2018-10-10 20:20:40 +00:00
- text: '< code > destroyer([" tree" , " hamburger" , 53], " tree" , 53)</ code > debe devolver < code > [" hamburger" ]</ code > .'
2018-10-08 17:34:43 +00:00
testString: 'assert.deepEqual(destroyer(["tree", "hamburger", 53], "tree", 53), ["hamburger"], "< code > destroyer(["tree", "hamburger", 53], "tree", 53)< / code > should return < code > ["hamburger"]< / code > .");'
2018-10-10 20:20:40 +00:00
- text: '< code > destroyer([" possum" , " trollo" , 12, " safari" , " hotdog" , 92, 65, " grandma" , " bugati" , " trojan" , " yacht" ], " yacht" , " possum" , " trollo" , " safari" , " hotdog" , " grandma" , " bugati" , " trojan" )</ code > debe devolver < code > [12,92,65]</ code > .'
2018-10-08 17:34:43 +00:00
testString: 'assert.deepEqual(destroyer(["possum", "trollo", 12, "safari", "hotdog", 92, 65, "grandma", "bugati", "trojan", "yacht"], "yacht", "possum", "trollo", "safari", "hotdog", "grandma", "bugati", "trojan"), [12,92,65], "< code > destroyer(["possum", "trollo", 12, "safari", "hotdog", 92, 65, "grandma", "bugati", "trojan", "yacht"], "yacht", "possum", "trollo", "safari", "hotdog", "grandma", "bugati", "trojan")< / code > should return < code > [12,92,65]< / code > .");'
```
< / section >
## Challenge Seed
< section id = 'challengeSeed' >
< div id = 'js-seed' >
```js
function destroyer(arr) {
// Remove all the values
return arr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
2018-10-10 20:20:40 +00:00
2018-10-08 17:34:43 +00:00
```
< / div >
< / section >
## Solution
< section id = 'solution' >
```js
2018-10-10 20:20:40 +00:00
// solution required
2018-10-08 17:34:43 +00:00
```
< / section >