JavaScript·Intermediate·Conceptual·1 min read
Should cleanup set every local variable to null?
Short interview answer
No. Locals naturally become unreachable when their environment is no longer retained. Cleanup should release long-lived ownership—unsubscribe, disconnect observers, clear timers, abort work, and bound caches—rather than ritualistically nulling short-lived variables.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.