I want to remove specific elements in the original array (which is var a
). I filter()
that array and splice()
returned new array. but that doesn't affect the original array in this code. How can I easily remove those elements from the original array?
var a = [{name:'tc_001'}, {name:'tc_002'}, {name:'tc_003'}]
var b = a.filter(function (e) {
return e.name === 'tc_001';
});
b.splice(0,1);
console.log(a);
console.log(b);