blob: 1367052700cc5644c6c3ee6a9d2362424c62788c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// 'this' is lexically scoped in arrow functions
var obj = {
f: function (expected) {
assertEq(this, expected);
return a => this;
}
};
var g = obj.f(obj);
assertEq(g(), obj);
var obj2 = {f: obj.f};
var g2 = obj2.f(obj2);
assertEq(g2(), obj2);
assertEq(g(), obj);
|