var Counter = function () {
this.count = 0;
this.tick = function () {
this.count++;
console.log(this.count);
}
};
var myCounter = new Counter();
myCounter.tick()
var myCounter = new Counter()
myCounter.tick()
setTimeout(myCounter, 1000)
-> Que se passe t'il ? -> Lire la document de this sur https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this -> Corriger le code
Philip Roberts: What the heck is the event loop anyway? | JSConf EU 2014 https://www.youtube.com/watch?v=8aGhZQkoFbQ