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

13 lines
327 B
JavaScript

const removeFromArray = function () {
array = arguments[0];
for (let i = 1; i < arguments.length; i++) {
let index = array.indexOf(arguments[i]);
if (index != -1) {
array.splice(index, 1);
}
}
return array;
};
// Do not edit below this line
module.exports = removeFromArray;