This factory uses a closure to create independent counters. What does it log?
function makeCounters() {
let shared = 0;
const inc = () => ++shared;
const counter = () => { let n = 0; return () => inc() + (++n); };
const a = counter();
const b = counter();
return [a(), a(), b()];
}
console.log(makeCounters());