trying this, I would expect an errormessage for incrementing a.
In Espruino, a is incremented twice, and in log there is 1 3 5 ....21 23
But by typing console.log(b.a) thje answer is 0, always.
I'm confused, so is the problem on my side or is it Espruino ?
function test(){
var interval;
this.a = 0;
interval = setInterval(function(){
a++;
this.a++;console.log(a,this.a);
},2000);
}
var b = new test();
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
trying this, I would expect an errormessage for incrementing a.
In Espruino, a is incremented twice, and in log there is 1 3 5 ....21 23
But by typing console.log(b.a) thje answer is 0, always.
I'm confused, so is the problem on my side or is it Espruino ?