Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavaScriptclosures as a patternSingle-choice MCQ

Each function pushed into `handlers` is meant to remember its index. What does calling `handlers[1]()` log, and why?

const handlers = []; for (let i = 0; i < 3; i++) { handlers.push(() => i); } console.log(handlers[1]());