@pengzhanbo/utils - v3.7.3
    Preparing search index...

    Function union

    • Union two arrays

      两个数组的并集

      Type Parameters

      • T

        The type of elements in the array / 数组元素的类型

      Parameters

      • a: readonly T[]

        The first array to union. 第一个数组

      • b: readonly T[]

        The second array to union. 第二个数组

      Returns T[]

      A new array containing unique elements from both arrays. 包含两个数组中唯一元素的新数组

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