Function setDifference

  • Returns a new set that contains all elements of the first set that are not in the second set.

    Type Parameters

    • T

      The type of elements in the set.

    Parameters

    • set1: Set<T>

      The first set.

    • set2: Set<T>

      The second set.

    Returns Set<T>

    A new set that contains all elements of the first set that are not in the second set.

    Example

    new Set([1, 2, 3, 4]);;
    //=> Set {1, 2, 3, 4}
    new Set([3, 4, 5, 6]);;
    //=> Set {3, 4, 5, 6}
    setDifference(new Set([1, 2, 3, 4]), new Set([3, 4, 5, 6]));;
    //=> Set {1, 2}

Generated using TypeDoc