What is the result of the following code?
function createCounter() {
let counter = 0;
return function() {
return ++counter;
};
}
const myCounter = createCounter();
console.log(myCounter());
What is the result of the following code?
function createCounter() {
let counter = 0;
return function() {
return ++counter;
};
}
const myCounter = createCounter();
console.log(myCounter());