PRACTICE / UNDERSTAND / REPEAT

JavaScript practice question

Practice closures with self-contained questions. Check your answer, then use the explanation to understand the reasoning.

1 questionAnswers explainedFree · no login

Try this question

Closures · MCQQuestion link ↗

What does this function return?

let count = 6;
const next = () => ++count;
next();
Choose one answer
Answer & explanation

Answer: 7

The inner function closes over `count` and keeps access to the binding after `makeCounter` returns.