Posts

Showing posts from June, 2020

What are Observables?

According to the definition, Observables defined as lazy Push collections of multiple values. Don't confuse, Now just bear with me, soon all your doubts will be gone. Before Diving into understanding the Observables, lets understand two strategies or protocols PUSH & PUll used in the programming languages. Now when you write some code, it means some code is producing some data & other code is going to consume it. So in simple terms we may have a Data-Producer, which produce the data and Data-Consumer who is just going to consume it. So let's take an example to understand Producer and Consumer. Let suppose we have a function sum & som code is calling it. // producer   function foo() {   return 1;   }   // consumer   const val = foo();   console.log(val); Here, you can simply say that function foo is producing data, So you can consider it as a Producer. And the below code is calling foo to consume the data, So it you can consider it as a Consumer. Now,