michael@0: // 'this' is lexically scoped in arrow functions michael@0: michael@0: var obj = { michael@0: f: function (expected) { michael@0: assertEq(this, expected); michael@0: return a => this; michael@0: } michael@0: }; michael@0: michael@0: var g = obj.f(obj); michael@0: assertEq(g(), obj); michael@0: michael@0: var obj2 = {f: obj.f}; michael@0: var g2 = obj2.f(obj2); michael@0: assertEq(g2(), obj2); michael@0: assertEq(g(), obj); michael@0: