Using the merge() operator

In the last section, we learned to use the concat() operator to concatenate observables keeping the order of each observable from left to right.  We also saw that if one of the observables is infinite, the other observables after this will never propagate this data. When we want to concatenate observables preserving the order of the data instead of the order of the observable, we use the merge() operator.

This operator has the following signature:

observable.merge(observable); 

It accepts any number of arguments, but they all must be observables:

  • observable: This is the other observable to be merged
There is another signature for this method where you can set the maximum number of observables being subscribed ...

Get Mastering Reactive JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.