Function union

  • Creates an array of unique values, in order, from all given arrays using SameValueZero for equality comparisons.

    Type Parameters

    • T

    Parameters

    • ...arrays: T[][]

      The arrays to inspect.

    Returns T[]

    Returns the new array of combined values.

    5.20.0

    [[difference]], [[unionBy]], [[unionWith]], [[without]], [[xor]], [[xorBy]]

    union([2, 3], [1, 2])
    // => [2, 3, 1]
  • Creates an array of unique values, in order, from all given arrays using SameValueZero for equality comparisons.

    Parameters

    • ...arrays: any[][]

      The arrays to inspect.

    Returns any[]

    Returns the new array of combined values.

    5.20.0

    [[difference]], [[unionBy]], [[unionWith]], [[without]], [[xor]], [[xorBy]]

    union([2, 3], [1, 2])
    // => [2, 3, 1]