I want to remove specific elements in the original array (which is var a). I filter() that array and splice() returned new array. but
So if I understood, you want to remove the elements that matches the filter from the original array (a) but keep them in the new array (b) See if this solution is what you need:
var a = [{name:'tc_001'}, {name:'tc_002'}, {name:'tc_003'}]
var b = a.filter(function (e) {
return e.name === 'tc_002'
});
b.forEach(function(element) {
console.log(element)
var index = a.indexOf(element)
console.log(index)
a.splice(index, 1)
})
Result: a = [{"name":"tc_001"},{"name":"tc_003"}] b = [{"name":"tc_002"}]