Function setSymmetricDifference

  • Calculates the symmetric difference between two sets. The symmetric difference of two sets is the set of elements that are in either of the sets, but not in their intersection.

    Type Parameters

    • T

      The type of elements in the input sets.

    Parameters

    • setA: Set<T>

      The first set.

    • setB: Set<T>

      The second set.

    Returns Set<T>

    A new Set containing the symmetric difference between the input sets.

    Example

    const setA = new Set([1, 2, 3]);
    const setB = new Set([2, 3, 4]);
    setSymmetricDifference(setA, setB);
    //=> Set([1, 4])

Generated using TypeDoc