#JavaScript - remove sub-array

Given 2 arrays, this piece of javascript filter function removes all elements of the 2nd array from the 1st array

array1.filter((item) => array2.indexOf(item) === -1)

Example:

const arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3]
const arr2 = [2, 4, 6, 7]
const arr3 = arr1.filter((item) => arr2.indexOf(item) === -1)
// arr3 is [ 1, 3, 5, 8, 9, 10, 1, 3 ]