RxJS - Creation Operator range



This operator will create an Observable that will give you a sequence of numbers based on the range provided.

Syntax

range(start: number, count: number): Observable

Parameters

start − The first value will be from start and will emit sequentially until the count given.

count − the count of numbers to be emitted.

Return value

It returns an Observable that will give you a sequence of numbers based on the range provided.

Example

import { range } from 'rxjs';
let ints = range(1, 10);
ints.subscribe(x => console.log(x));

Output

range Operator
Advertisements