ByteDance·Frontend Engineer·Technical Phone Screen
Apr 2026
Bytedance frontend screen, pretty JS-heavy. They threw a classic var/let loop question at me and wanted a full breakdown of what prints and why, not just the answer.
- Given a for loop using `var` with a `setTimeout` inside, what does the code print and in what order? Then explain what changes if you swap `var` for `let`, covering scope differences, closure behavior, and sync vs async execution order.
“I knew the punchline (all 5s with var, 0 through 4 with let) but fumbled explaining why the console.log after the loop fires before any of the timeouts.” The rest of the author's notes on Frontend Engineer interview at ByteDance, Technical Phone Screen round, covers how they worked through the question, what the panel pushed back on, and what they would do differently.
View Post