codetrix - v1.5.0
    Preparing search index...

    Function intersect

    • Returns a new array containing only the elements common to all input arrays.

      Type Parameters

      • T

        The type of array elements.

      Parameters

      • ...arrays: T[][]

        Two or more arrays to intersect.

      Returns T[]

      An array of elements found in all input arrays.

      intersect([1, 2, 3], [2, 3, 4]); // [2, 3]