Get Programming with JavaScript - Listing 11.09
Listing 11.09 - Multiple counters
var getCounter = function () {
var counter = 0;
return function () {
counter = counter + 1;
return counter;
};
};
var peakCount = getCounter();
var climbCount = getCounter();