All challenges
Multiple ChoiceHard 30s

Closure Pitfall in Loops

Choose the best answer for: creating closures in loops
Options
  1. 1Closures cannot be created inside loops in JavaScript at all
  2. 2Only arrow functions work in loops and plain fn cannot close
  3. 3Use let in for loops to capture per-iteration values in closures
  4. 4var captures per-iteration values so each closure is distinct

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle