Skip to content

Latest commit

 

History

History
18 lines (10 loc) · 732 Bytes

what_are_the_differences_between_promises_and_observables.md

File metadata and controls

18 lines (10 loc) · 732 Bytes

What are the differences between Promises and Observables?

Promises and Observables are both used for handling asynchronous operations, but they have key differences:

  • Promises: Represent a single value that will be resolved or rejected in the future.
  • Observables: Represent a stream of values that can emit multiple values over time.

Example of Promise:

let promise = new Promise((resolve, reject) => { resolve('Resolved'); });

Tags: advanced, JavaScript, Promises, Observables