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

10 lines
230 B
JavaScript

const removeFromArray = function(list, ...args) {
args.forEach(arg => {
index = list.indexOf(arg);
if (index > -1) list.splice(index, 1);
});
return list;
};
// Do not edit below this line
module.exports = removeFromArray;