A utility function that returns the difference between two arrays.

arrayDifference([1, 2, 3], [2, 3, 4]) // [1]
arrayDifference([1, 2, 3], [4, 5, 6]) // [1, 2, 3]
  • Type Parameters

    • T

    Parameters

    • array1: T[]

      The first array.

    • array2: T[]

      The second array.

    Returns T[]

    An array containing the difference between the two arrays.