JS Questions I Ask Senior Frontend Candidates

A 5-question screen I run on every senior frontend candidate. Each one has a junior answer that passes, a mid-level answer that almost passes, and a senior answer I am actually looking for.

Question Bundle
JavaScript
interview-prep
frontend
closures
js-event-loop
rohanbakr

By @rohanbakr

January 14, 2026

·

Updated August 13, 2026

219 views

1

4.5 (15)

When I screen senior frontend candidates I open with: "Walk me through what happens when you call setState from inside a useEffect that has no dependency array." I want to see whether they reason about render loops without me prompting. Show the version I expect a senior to draw.

Candidate transcript

I expect them to trace the loop on the whiteboard:

JavaScript
useEffect(() => { setCount((c) => c + 1); });
// render 1 -> effect runs -> setState -> render 2 -> effect runs again -> render 3 -> ...
// React eventually throws "Too many re-renders" or freezes the tab.

4 more questions and all solutions are locked.

Purchase this item to access all questions, code snippets, and solutions.