What are the differences between observables and promises in JavaScript?

What is the difference between observables and promises?

Simply put: A promise resolves to a single value asynchronously, an observable resolves to (or emits) multiple values asynchronously (over time).

Concrete examples:

  • Promise: Response from an Ajax call
  • Observable: Click events

More information can be found here: http://reactivex.io/intro.html

i’ve read that observables are looking to overtake promises

Unlikely. Observables might be the better solution to certain problems, but that doesn’t make promises obsolete (if that’s what you mean).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)