RemoveFromArray Solution
This commit is contained in:
parent
888383a44e
commit
cd63cf311b
|
@ -1,5 +1,18 @@
|
||||||
const removeFromArray = function() {
|
const removeFromArray = function(...parameters) {
|
||||||
|
const thisArray = parameters[0];
|
||||||
|
const newArray = [];
|
||||||
|
|
||||||
|
thisArray.forEach((e) => {
|
||||||
|
if (!parameters.includes(e)){
|
||||||
|
newArray.push(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return newArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
const removeFromArray = function(...arg){
|
||||||
|
const array = arg[0];
|
||||||
|
return array.filter(val => !arg.includes(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = removeFromArray
|
module.exports = removeFromArray
|
||||||
|
|
Loading…
Reference in New Issue