JavaScript Standard built-in objects @ Tue, Feb 28, 2023 2:39 PM
JavaScript Standard built-in objects @ Tue, Feb 28, 2023 3:08 PM
Expand 17 lines ...
18
fun.caller === arguments.callee.caller  
18
fun.caller === arguments.callee.caller  
19
arguments.callee 代表的是正在执行的fun     
19
arguments.callee 代表的是正在执行的fun     
20
The **`caller`** accessor property of [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) instances represents the function that invoked this function. For [strict](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode), arrow, async, and generator functions, accessing the `caller` property throws a [`TypeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError).
20
The **`caller`** accessor property of [`Function`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) instances represents the function that invoked this function. For [strict](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode), arrow, async, and generator functions, accessing the `caller` property throws a [`TypeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError).
21
+

22
+

23
+
## 关于 this 的一个问题 
24
+

25
+
```js
26
+
let obj, method;
27
+

28
+
obj = {
29
+
  go: function() { console.log(this); }
30
+
};
31
+

32
+
obj.go();               // (1) this obj
33
+

34
+
(obj.go)();             // (2) this obj
35
+

36
+
(method = obj.go)();    // (3) dom 环境是 window,node 环境 global
37
+

38
+
(obj.go || obj.stop)(); // (4) dom 环境是 window,node 环境 global
39
+
```