odin-javascript-exercises/removeFromArray/removeFromArray.js

14 lines
299 B
JavaScript
Raw Normal View History

2017-11-20 11:51:01 -08:00
var removeFromArray = function(array) {
elementsToRemove = [...arguments]
elementsToRemove.splice(0,1)
elementsToRemove.forEach(element => {
let index = array.indexOf(element)
if (index > -1) {
array.splice(index, 1)
}
})
return array
2017-08-24 06:12:11 -07:00
}
module.exports = removeFromArray