1var colors = ["red",undefined,"","blue",null,"crap"];
2// remove undefined, null, "" and any other crap
3var cleanColors=_.without(colors,undefined,null,"","crap");
4//cleanColors is now ["red","blue"];
1var a = [
2 {id: 1, name: 'A'},
3 {id: 2, name: 'B'},
4 {id: 3, name: 'C'},
5 {id: 4, name: 'D'}
6];
7var removeItem = [1,2];
8removeItem.forEach(function(id){
9 var itemIndex = a.findIndex(i => i.id == id);
10 a.splice(itemIndex,1);
11});
12console.log(a);