NG Interview Set I - Observables Questions Flashcards

NG Interview Set I - Observables Questions

1
Q

What are observables?

A
  • They provide a declarative way of message passing between publishers and subscribers in an application
  • They typically produce one or more values over time, which are subscribed to by observers
  • They provide some advantages over promises
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is RxJS?

A
  • RxJS stands for Reactive Extensions for JavaScript, and is a reactive programming library centered around observables and operators making it easier to write complex asynchronous code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do observables differ from promises?

A
  • Observables are declarative; promises execute immediately upon creation
  • Observables can provide many values, whereas promises provide one value
  • Observables are cancellable, whereas promiess aren’t
  • Error handling also differs between them
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are some advantages to using observables?

A
  • Observables are cancellable; they come with powerful transformative functions (especially when using RxJS) to make asynchronous coding easier
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Does an observable compute anything if it has no calls to subscribe?

A
  • No, it will not
How well did you know this?
1
Not at all
2
3
4
5
Perfectly