I
IntLOG
Hi, how can I increment a value by one at every click?
I tried the following code but the value always remains 1:
function Foo(){
this.iCount=0;
}
Foo.prototype.addOne = function(){
this.iCount+=1;
}
instance = new Foo();
<button onClick='a=instance.addOne();alert(a);'>Click</button>
How can I reach my goal??
I tried the following code but the value always remains 1:
function Foo(){
this.iCount=0;
}
Foo.prototype.addOne = function(){
this.iCount+=1;
}
instance = new Foo();
<button onClick='a=instance.addOne();alert(a);'>Click</button>
How can I reach my goal??