The debounce operator emits a value from the source Observable only after a particular time span determined by another Observable has passed. After the time span it emits the last value emitted by the source observable.

Signature

debounce(durationSelector: Function): MonoTypeOperatorFunctiondurationSelector: It is a function that receives the time span value from the source observable and stops emitting input values till the time span is elapsed.MonoTypeOperatorFunction: It is a function that returns an observable as output.

An example of the debounce operator is given below.

const source = of( 1 , 2 , 3 , 4 , 5 …


Little John is just going to start his fourth standard this academic year. He heard it somewhere that the population of the world is around 8 billion.
He knew God created the universe and the human beings . But this enormous number struck his little mind and days in and days out he kept on thinking.
How did God get to create so many human beings. It was a Sunday afternoon and he finally asked his mom, “Mom, how come God created so many human beings. Does not He feel tired creating one human after another. “How does He has so…


We know what is a garbage. Garbage essentially refers to things which are no longer of use. When it comes to programming, Garbage Collection means cleaning the memory spaces which don’t contain useful data and then reallocating those cleared memory to some other data which is both active and useful. That is the basic process of Garbage Collection in pretty much all the programming languages in the world. Some programming languages needs explicit interference from the developer while some other languages do this automatically. A low level programming language like C, requires the developer to free the memory by the…


The count operator counts the number of values emitted from the source observable.This operator returns an output observable as a number specifying the number of elements emitted by the source observable. The count operator returns the value after the source observable completes.

Signature

count(predicate?: Function): OperatorFunctionpredicate: it is a function that returns a boolean and it specifies what values are to be counted.OperatorFunction: A function that returns an observable as a number.

Without the predicate passed the count operator counts all the values emitted by the source observable as given below.

const source = of( 1 , 2…


The concatMapTo operator maps each source value to the given Observable innerObservable regardless of the source value, and then flattens those resulting Observables into one single Observable, which is the output Observable. Each new value emitted is concatenated to the previous value.It projects each source value to the source observable and flattens it.

Signature

concatMapTo(innerObservable, resultSelector, outerIndex): OperatorFunctionresultSelector: optional parameter
OperatorFunction: A function that emits output as observable

An example of the concatMapTo operator is given below.

const source = of( 1 , 2 , 3 );source.pipe(concatMapTo(interval( 1000 ).pipe(take( 3 )))).subscribe((val) => {console.log(val);});

And the corresponding output will be:

// 0// 1// 2// 0// 1// 2// 0// 1// 2

This is pretty much the basics of the concatMapTo operator in RxJS.


Hoisting in English language means to pull something up. You must have been to the National Day celebration event, aren’t you? On that occasion, the chief guest approaches the mast and he pulls some rope and the flag goes up, right. This is exactly what happens in JavaScript albeit with some change. In JavaScript the functions and variables are hoisted to the top of the scope. Let’s see some use cases for that to understand the hoisting concept better. But before that let’s gather some common knowledge about the process.

First thing first. Just keep it in mind that whenever…


The concat operator creates an output Observable which sequentially emits all values from given Observable and then moves on to the next.This operator first emits the values from the first observable, then the second observable and so on.

Signature

concat(...observables): Observable

The simplest example of the concat operator can be as follows.

const ob1$ = of( 1 , 2 , 3, 4 );const ob2$ = interval( 1000 ).pipe(take( 4 ));const result = concat(ob1$, ob2$);result.subscribe(val => console.log(val));

Here we pass two observables and then pass the references of these observables to the concat operator and store the expression…


Combines multiple Observable to create an Observable whose values are calculated from the latest values of each of its input Observables.Whenever any input observable emits a value, it computes a formula using the latest values from all the inputs, then emits the output of that formula.

combineLatest combines the values from all the Observables passed as arguments. This happens by subscribing to each Observable in order and, whenever any Observable emits, collecting an array of the most recent values from each Observable. …


Array is a very special concept in any programming language. All the major programming languages support the array data structure. Before going into the technicalities of the array from a programming point of view, let’s try to understand what an array is from a common man’s perspective.

Have you ever seen a school assembly? It is pretty obvious, you have seen it and in childhood all of us have been part of that boring event. In the assembly hall, students of the same class or section sit together in one row, isn’t it. …


Buffers the source Observable values until the size hits the maximum bufferSize provided. It also takes an optional parameter called startBufferEvery which is the value interval of creating a new buffer.

Signature

bufferCount(bufferSize: number, startBufferEvery: number = null): OperatorFunction

Buffers a number of values from the source Observable by bufferSize then emits the buffer and clears it, and starts a new buffer each startBufferEvery values.

If startBufferEvery is not provided or is null, then new buffers are started immediately at the start of the source and when each buffer closes and is emitted.

A sample code snippet for the bufferCount…

Satyapriya Mishra

Software Developer | Author.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store