Snow

RXJS primer

Got it. Let’s build you a dual-mode RxJS + Angular interview arsenal — one version for when you’re rusty and need a fast reboot, and another for when you’re walking into a toxic interview and want to dominate the room with precision and zero tolerance for BS.

🧠 Mode 1: “I’ve Forgotten All This Shit” — RxJS + Angular Refresher

🔧 Core Concepts

Term

What It Means

Observable

A stream of values over time. Think async events, HTTP responses, etc.

Subject

An observable you can manually push values into. Good for multicasting.

BehaviorSubject

Like Subject, but holds the latest value. Useful for state.

pipe()

Chains operators to transform the stream.

Subscription

You subscribe to start receiving values. You must unsubscribe to avoid leaks.

🛠️ Common Operators

Operator

Use Case

map

Transform each value (x => x * 2)

filter

Only pass values that meet a condition

switchMap

Cancel previous inner observable when a new one comes in (e.g. HTTP)

debounceTime

Wait before emitting (e.g. search input)

takeUntil

Auto-unsubscribe when another observable emits

combineLatest

Combine multiple streams into one

🧪 Angular Use Cases

private destroy$ = new Subject(); ngOnDestroy() { this.destroy$.next(); this.destroy$.complete(); } this.stream$.pipe(takeUntil(this.destroy$)).subscribe();

🔥 Mode 2: “Hostile Interviewer, Toxic Environment” — Dominate with Precision

🧨 Popular Interview Questions + Tactical Responses

Question

Tactical Response

“Do you even understand reactive programming?”

“Yes. It’s declarative async logic using streams. RxJS lets me model complex workflows cleanly — Promises can’t touch that.”

“Why not just use Promises?”

“Because I don’t want to write spaghetti code for retries, cancellations, or event coordination. RxJS handles that with composable operators.”

“How do you manage subscriptions?”

“I use takeUntil with a Subject in ngOnDestroy, or async pipe in templates. No leaks, no drama.”

“What’s the difference between switchMap and mergeMap?”

switchMap cancels the previous inner observable — perfect for HTTP. mergeMap runs all inner observables concurrently.”

“How do you handle backpressure?”

“Depends on the context — debounceTime, throttleTime, or buffering operators like bufferTime.”

🧱 Pushback Handling (When They Try to Flex)

🧠 Gotchas to Mention (Shows You’re Battle-Tested)

🧨 Final Power Moves