javascript-collections-framework
    Preparing search index...

    Function setOf

    • Returns an immutable set of elements in first-seen order, as new Set builds it: equal elements are kept once (SameValueZero, so -0 is stored as 0 and NaN is one member), and null and undefined are stored. Every method that would change the set, its cursors or views throws UnsupportedOperationError.

      Time: O(n) average for n elements.

      Type Parameters

      • E

      Parameters

      • ...elements: E[]

        The elements.

      Returns ReadonlySetCollection<E>

      An immutable set.

      const flags = setOf('a', 'b', 'a')
      flags.has('b') // true
      String(flags) // "ImmutableSet(2) {'a', 'b'}"