javascript-collections-framework
    Preparing search index...

    Function disjoint

    • Returns true when a and b have no element in common. When b is a collection from this library, each element of a is looked up with b.has, so b's key, equivalence or comparator applies; otherwise, when a is one, each element of b is looked up with a.has; otherwise elements are compared with SameValueZero. With collections that compare differently, the answer can depend on the order of the arguments. Maps are iterated as their entries; pass map.keys() to compare keys.

      Time: O(n + m) expected with hash lookups, O(n log m) with a sorted collection, O(n·m) with a list.

      Parameters

      • a: Iterable<unknown>

        Any iterable.

      • b: Iterable<unknown>

        Any iterable.

      Returns boolean

      Whether no element is in both.

      TypeError when either argument is not iterable.

      disjoint([1, 2], new HashSet([3, 4])) // true