I'm surprised this doesn't work. (I'm running iojs
2.3.0 with the --harmony_arrow_functions
flag.)
class Foo {
constructor() { this.foo = "foo"; }
sayHi() { return (() => this.foo)(); }
}
f = new Foo();
f.sayHi // Cannot read property 'foo' of undefined.
I would have expected the arrow function to pick up the right value for this
. Am I missing something?