Tanya51,
может так?
function createCounter(){
var Count = 1;
createCounter.prototype.inc = function () {
Count++;
};
createCounter.prototype.dec = function () {
Count--;
};
createCounter.prototype.getValue = function () {
return Count
};
}
var counter = new createCounter();
counter.inc();
counter.inc();
counter.inc();
counter.dec();
alert( counter.getValue() );