Question PRG-JS-0018
HardWhat is the output of this program?
function counter() {
let count = 0;
return () => ++count;
}
const next = counter();
console.log(next(), next());
- A.
Error
- B.
2 2
- C.
Sign up free to see the answer and a step-by-step explanation.