This file focuses on browser-side JavaScript topics that often appear in frontend interviews after the core language basics.
Strong frontend JavaScript means understanding the DOM, browser rendering, event handling, and how JavaScript decisions affect perceived performance.
- The DOM is a browser object model, not part of the language itself.
- DOM updates can trigger style recalculation, layout, and paint.
- Too many read-write layout cycles can hurt performance.
Instead of attaching many listeners to many child nodes, attach one listener higher in the tree and inspect the event target.
- Less memory overhead
- Works well for dynamic content
- Simpler listener management
localStoragepersists across sessionssessionStoragelasts for a tab session- IndexedDB is better for larger structured client storage
fetchAbortControllerIntersectionObserverResizeObserverrequestAnimationFrame
- Use
requestAnimationFramefor animation work. - Avoid expensive work inside scroll and resize listeners.
- Prefer CSS for simple visual transitions when possible.
A pattern where a parent handles events for children by relying on event bubbling.
Because browser rendering may need style recalculation, layout, and paint after updates.
To cancel in-flight fetch requests or other abortable browser operations.