Remove object in array using filter and splice which one is best approach in JavaScript?

I think chrystian’s answer is the right one but I want to add a warning (not related to performance but to avoid a potential undesired bug)

WARNING: One small detail, be careful when you use splice with indexOf. If indexOf returns (-1), that’s to say the element wasn’t found, splice will remove the last element of the array (negative indexing works).

If you decide to use splice instead of filter take that into consideration and check for the indexOf result before doing splice

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)