javascript-collections-framework
    Preparing search index...

    Function listOf

    • Returns an immutable list of elements, in argument order, duplicates kept. null and undefined are stored. Every method that would change the list, its views or its cursors throws UnsupportedOperationError.

      For many elements, use copyOfList: spreading a large array into a call fails at the call site.

      Time: O(n) for n elements.

      Type Parameters

      • E

      Parameters

      • ...elements: E[]

        The elements.

      Returns ReadonlyList<E>

      An immutable list.

      const days = listOf('mon', 'tue', 'tue')
      days.get(1) // 'tue'
      String(days) // "ImmutableList(3) ['mon', 'tue', 'tue']"