function counter() {
let count = 0;
return function() {
console.log(count);
count++;
}
}
 
const one = counter();
 
one()
one()
one()
Code will run automatically after changes.
Code runs in an isolated environment.