Function arrayIntersection

A utility function that returns the intersection between two arrays.

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

    • T

    Parameters

    • array1: T[]

      The first array.

    • array2: T[]

      The second array.

    Returns T[]

    An array containing the intersection between the two arrays.