Great ! We can use forEach !
Maybe in Ecmascript 7 we'll finally get rid of
var me = this;
Maybe in Ecmascript 7 we'll finally get rid of
var me = this;
element.addEventListener('click', function(e) {
this.foo();
}.bind(this), false);
Notice the call to "bind" which binds the click handler function to the current object, so that inside it can call this.foo().element.addEventListener('click', e => this.foo(), false);
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...