Hi I delete an object in an array using two approaches:- splice and filter.
splice code here:-
(this.myArray).splice((this.myArray).indexOf(myobject), 1);
filter code here:-
(this.myArray).filter(obj => obj !== myobject);
Please tell us differences between both and which one is the best approach?
I think that the main difference here is:
angular has nothing to do here and when it comes to speed, splice will win
and small test as proof https://jsperf.com/array-splice-vs-array-filter/1