passed all tests
This commit is contained in:
parent
6d9ef80b72
commit
0c54c04f03
|
@ -1,6 +1,6 @@
|
||||||
// PASSED ALL TESTS:
|
// MY VERSION THAT PASSED ALL TESTS:
|
||||||
|
|
||||||
const removeFromArray = function([a, ...b], c, ...d) {
|
/* const removeFromArray = function([a, ...b], c, ...d) {
|
||||||
|
|
||||||
let firstArray = [a, ...b];
|
let firstArray = [a, ...b];
|
||||||
let secondArray = [c, ...d];
|
let secondArray = [c, ...d];
|
||||||
|
@ -13,6 +13,17 @@ const removeFromArray = function([a, ...b], c, ...d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// FROM THE SOLUTION:
|
||||||
|
|
||||||
|
// A simpler, but more advanced way to do it is to use the 'filter' function,
|
||||||
|
// which basically does what we did with the forEach above.
|
||||||
|
|
||||||
|
var removeFromArray = function(array, ...args) {
|
||||||
|
return array.filter(val => !args.includes(val))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Do not edit below this line
|
// Do not edit below this line
|
||||||
module.exports = removeFromArray;
|
module.exports = removeFromArray;
|
||||||
|
|
Loading…
Reference in New Issue