Tweakr
    Preparing search index...

    Function intersection

    • Returns an array of elements common to both input arrays.

      Type Parameters

      • T

      Parameters

      • a: T[]

        The first array.

      • b: T[]

        The second array.

      Returns T[]

      A new array containing the elements found in both arrays.

      intersection([1, 2, 3], [2, 3, 4]);
      // → [2, 3]

      intersection(["a", "b"], ["c", "d"]);
      // → []

      1.0.0