Design Patterns · Senior · Question 12 of 75

How does an RxJS Observable differ from a Promise?

Explanation

A promise starts immediately, delivers one value and can't be cancelled. An Observable starts on subscription, can emit many values (events, WebSocket), is cancelled by unsubscribing and has operators (debounceTime, switchMap). It's an implementation of Observer + Iterator.

Further reading

Problem with a question

Design Patterns · Senior · question 12

Test yourself

Take the Design Patterns · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz