PowerCounter.prototype = { increment: function() { if(this.value==0) this.value = 2; else this.value *= this.value; this.updateValue(); }, decrement: function() { if(this.value==2) this.value = 0; else this.value = Math.sqrt(this.value); this.updateValue(); }, };