const increaseCounter = (function() {
let counter = 0;
return function() {
counter = counter + 1;
console.log(counter);
};
})();
The IIFE run only once and initialize the counter variable with 0 then returns a function that can access the counter variable. So, when you call increaseCounter(), it will update the counter as expected.