Can someone explain me way the counter are called one time inside this function
let uniqueInteger = (function() {
let counter = 0;
function f() {
return counter++;
};
console.log("Form Inside " + String(counter));
return f;
}());
console.log(uniqueInteger());
console.log(uniqueInteger());
console.log(uniqueInteger());
The call of uniqueInteger should evaluate all body of that function event (let counter=0)
why it's done one time and each calls?