Function range

  • Create an iterator of evenly spaced values.


    • start: number

      The starting value for the range, inclusive.

    • Optional stop: number

      The stopping value for the range, exclusive.

    • Optional step: number

      The distance between each value.

    Returns IterableIterator<number>

    An iterator which produces evenly spaced values.


    In the single argument form of range(stop), start defaults to 0 and step defaults to 1.

    In the two argument form of range(start, stop), step defaults to 1.


    import { range } from '@lumino/algorithm';

    let stream = range(2, 4);

    Array.from(stream); // [2, 3]