Interviews1 answer
What is difference in observables and Promises?
1 Answer
Observables : Are lazy: they're not executed until we subscribe to them using the subscribe() method.
Promise : Are not lazy: execute immediately after creation.
Promise is eager, whereas the Observable is lazy.
Promise is always asynchronous, while the Observable can be either asynchronous or synchronous.
Promise can provide a single value, whereas the Observable is a stream of values (from 0 to multiple values).
We can apply RxJS operators to the Observable to get a new tailored stream.
Pranam BhatPosted May 28, 2021, 11:49 AM EDT


