What does this function return?
let count = 6;
const next = () => ++count;
next();Answer & explanation
Answer: 7
The inner function closes over `count` and keeps access to the binding after `makeCounter` returns.
Practice closures with self-contained questions. Check your answer, then use the explanation to understand the reasoning.
let count = 6;
const next = () => ++count;
next();Answer: 7
The inner function closes over `count` and keeps access to the binding after `makeCounter` returns.