function makeCounter() {
var currentCount = 1;
function counter() {
return currentCount++;
}
counter.set = function(value) {
currentCount = value;
};
counter.reset = function() {
currentCount = 1;
};
return counter;
}
var counter = makeCounter();
counter.set(5);
console.log(`counter --- `, counter()); // почему тут 5, а не 6?