1function createCounter() {2 let count = 0; // This is the variable that will be "closed over"34 return function() {5 count++; // This inner function has access to the 'count' variable6 console.log(count);7 return count;8 };9}1011const counter = createCounter();1213counter(); // Outputs: 114counter(); // Outputs: 215counter(); // Outputs: 31617// Creating a new counter18const counter2 = createCounter();1920counter2(); // Outputs: 121counter2(); // Outputs: 22223// The original counter is unaffected24counter(); // Outputs: 4