Loading…
Loading…
Frontend · Senior full stack preparation
Control asynchronous streams, debouncing and subscription lifecycles. Read practical answers and use the examples to explain your reasoning.
5 of 5 questions
debounceTime waits for a specified quiet period before emitting the latest value. It reduces unnecessary search/API calls during rapid typing. Pair it with distinctUntilChanged to ignore duplicate queries and switchMap to cancel stale HTTP observable subscriptions.
Link to question 10An Observable represents a lazy stream of zero or more values over time. Subscription starts execution for many cold streams; it can emit next/error/complete, and unsubscription releases resources. Hot streams may produce values independently of a subscriber.
Link to question 19A Promise resolves or rejects once and its executor runs immediately. An Observable can emit multiple values, compose cancellation and transformations, and commonly starts when subscribed. HttpClient Observables typically emit once and complete.
Link to question 20Inspect the Network initiator and call stack. Check duplicate subscriptions, multiple async pipes over cold HTTP streams, repeated component mounting, effects, resolver and ngOnInit overlap, interceptor retries and dev-mode behavior. Share the request only when the data lifecycle supports caching; avoid hiding an unintended duplicate.
Link to question 23Subject multicasts future emissions and has no current value. BehaviorSubject requires an initial value and immediately emits its latest value to new subscribers; use getValue sparingly and expose asObservable() to protect writes.
Link to question 24