odin-default-js-exercises/removeFromArray/removeFromArray.js

16 lines
268 B
JavaScript

const removeFromArray = function(...arg) {
const thisArray = arg[0];
let newArray = []
thisArray.forEach((e)=> {
if(!arg.includes(e)){
newArray.push(e);
}
});
return newArray;
};
module.exports = removeFromArray