Array#filter() vs Array#splice(Array#indexOf())#slice()

Edit on GitHub

Setup

const obj = {};
const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, obj, 14, 15, 16, 17, 18, 19, 20]

Tests

  • Array#filter()

    arr.filter(item => item !== obj);
  • Array#splice(Array#indexOf())#slice()

    arr.splice(arr.indexOf(obj)).slice()