You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Just to add, if you do:

    function test(){  
      var interval;
      console.log(this);
      this.a = 0;
      interval = setInterval(function(){
          this.a++;console.log(this,this.a);
        },2000);
    }
    var b = new test();
    

    and compare, it looks like this is handled fine. The issue is that undefined+1 (and hence this.a++) returns NaN in other JS implementations, but in Espruino it just returns 1. I'll make a bug for that, and also for a++ errors so at least we can track it.

    bugs:

    https://github.com/espruino/Espruino/iss­ues/146
    https://github.com/espruino/Espruino/iss­ues/147

About

Avatar for Gordon @Gordon started