set.concat()

Learn: Sets

Concatenate two Sets.

Loading strategy:

Signature

concat(other: Set<B>) => Set<A | B>

Description

Creates a Set by copying the calling Set to a new Set and appending another Set.

The calling Set and the other Set aren’t changed.

Parameters

Parameter Type Required Description

other

Set<Generic>

true

Set to append to the calling Set.

Return value

Type Description

Set<Generic>

New Set composed of the concatenated Sets.

Examples

// `toSet()` converts an Array to a Set.
let setA = [1, 2, 3].toSet()
let setB = [4, 5, 6].toSet()

setA.concat(setB)
{
  data: [
    1,
    2,
    3,
    4,
    5,
    6
  ]
}
\