Get Programming with JavaScript - Listing 11.08
Listing 11.08 - Hiding the counter variable
var getCounter = function () {
var counter = 0;
var countUpBy1 = function () {
counter = counter + 1;
return counter;
};
return countUpBy1;
};
var count = getCounter();