Function union

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

    Type Parameters

    • T

    Parameters

    • Rest ...arrays: T[][]

      The arrays to inspect.

      Rest

    Returns T[]

    Returns the new array of combined values.

    Since

    5.20.0

    See

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

    Example

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

    • Rest ...arrays: any[][]
      Rest

    Returns any[]