Javatpoint Logo
Javatpoint Logo

RxJS range() Creation Operator

RxJS range() operator is a creation operator used to create an observable that emits a sequence of numbers within a specified range provided. It emits a sequence of numbers in a range.

In other words, we can say that the RxJS range() operator returns an observable that emits a particular range of sequential integers. It emits a range of sequential integers, in order, where you select the start of the range and its length.

Syntax:

Following is the syntax of the RxJS range() creation operator:

Or

Or

Parameter Explanation

  • start: It specifies the value of the first integer in the sequence. The first value will be from the start and will emit sequentially until the count is given. It is an optional argument. Its default value is 0.
  • count: It specifies the count of numbers to be emitted, which is the number of sequential integers to generate. It is also an optional argument. Its default value is undefined.
  • scheduler: It specifies a SchedulerLike to use for scheduling the emissions of the notifications. It is also an optional argument. Its default value is undefined.

Return value

The RxJS range() operator returns an observable number that emits a finite range of sequential integers or a sequence of numbers based on the range provided.

Let us see an example of the RxJS range() operator to understand it clearly.

Example

Output:

After executing the above example, you will see the following result:

RxJS range() Creation Operator

In the above example, you can see that it has emitted the sequential values up to 10 numbers which we have specified as a range in the example.


Next TopicRxJS Operators





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA