It turns out you can't replace all JavaScript functions with arrow functions because they do completely different things with `this` >_<
-
-
var a = { setX: (x) => { this._x = x; } }; a.setX(67); console.log(a._x); // undefined console.log(window._x); // 67
-
Of course if you're using both a setter and a getter it can take you quite a while to work out what's going on here -_-
- 8 more replies
New conversation -
-
-
@qntm get on the { setX(x) { this._x = x; } } bandwagon yoThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
@qntm Arrow functions *not* adding a new `this` binding was one of the major reasons for adding them.Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.