• Implementation of the subset operation in set theory, which checks if set A is a subset of set B. A subset means all elements of set A are elements of B.

    • Formal definition: A ⊆ B
    • This method runs in linear time, or O(n), where n = |A| (size of set A).

    Type Parameters

    • TElement

    Parameters

    • a: Set<TElement>

      Set A of type <TElement> elements

    • b: Set<TElement>

      Set B of type <TElement> elements

    Returns boolean

    Whether A ⊆ B is true

    See

    Set.prototype.isSubsetOf

    Example

    // {1} ⊂ {1, 3}
    isSubsetOf(new Set([1]), new Set([1, 3])); // true

Generated using TypeDoc