Observables are a pioneering concept in Reactive Programming. Observables are data source wrappers and then the observer executes some instructions when there is a new value or a change in data values. The Observable is connected to the observer who does the execution through subscription, with a subscribe method the observer connects to the observable to execute a code block.

If you do not know what is Reactive Programming, then check out my article on this website What is ReactiveProgramming in Javascript.

We will see following topics in this article.

  1. What is an observable?
  2. Difference between Observable and Promise
  3. Difference between Array and Observable
  4. Creating an observable
  5. Unsubscribe from an observable

What are Observables in Javascript

Observables are simply data streams or collections which arrive at a time. Observables are objects that can notify subscribers when the change is happening. We can wrap Observables as an object which contains the following things.

  1. Data Streams
  2. Some methods (next(), error(), complete())

Observables in RxJS

#observables #javascript #reactive programming

Observables in RxJS: How to Use Javascript Observables
1.25 GEEK