RemoveFromArray Solution

This commit is contained in:
Karem Quiroz 2020-07-01 19:08:43 -05:00 committed by GitHub
parent 888383a44e
commit cd63cf311b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

View File

@ -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