codejump

Operators & Subjects

Preview — 3 of 10 questions

What is the key difference between switchMap and mergeMap?

AswitchMap cancels the previous inner Observable when a new value arrives; mergeMap subscribes to all inner Observables concurrently
BswitchMap preserves order; mergeMap does not
CmergeMap is deprecated in favor of switchMap in RxJS 7
DswitchMap is for HTTP GET; mergeMap is for HTTP POST

Why are debounceTime and distinctUntilChanged typically combined for search inputs?

AdebounceTime deduplicates values; distinctUntilChanged adds a delay
BdebounceTime waits for the user to stop typing before emitting; distinctUntilChanged prevents re-triggering searches when the value hasn't actually changed
CThey cancel each other out and are only combined for backwards compatibility
DdebounceTime is required by the HTTP client to batch requests; distinctUntilChanged is optional

When does combineLatest emit?

AWhen any one of its source Observables emits, regardless of others
BWhen all source Observables complete
COnly when ALL source Observables have emitted at least one value, and then on every subsequent emission from any source
DWhen the first source Observable emits

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.