O'Reilly logo

Mastering Reactive JavaScript by Erich de Souza Oliveira

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Combining observables

The most important thing is to remember that you can even combine observables to create a new one using data from both.

There are three really important operators for this:

  • merge()
  • concat()
  • zip()

The concat() operator generates a new observable containing the data from all provided observables; the data is propagated on the new observable following the order of the observables, so it first propagates all the data from the first observable, and only after it finishes does it go to the next and so on. One important thing is that, if one observable is infinite (and for this reason never finishes), it never goes to the next.

The merge() operator is similar to the concat() operator, but it follows the order of the values, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required