arguments.callee屬性用于返回當前正在執行的Function對象。
## 語法
```
[functionObject.]arguments.callee
```
## 返回值
arguments.callee屬性的值為Function類型,返回當前正在執行的函數。
簡而言之,arguments.callee 返回該 arguments 對象所屬的函數。
arguments.callee屬性是arguments對象的一個成員,該屬性僅當相關函數正在執行時才可用。
arguments.callee屬性的初始值是正被執行的Function對象。這將允許匿名函數成為遞歸的。
## 示例&說明
```
function test(){
// "test."可以省略
document.writeln( test.arguments.callee ); // function test(){ document.writeln( arguments.callee ); document.writeln( arguments.callee === test ); }
// arguments.callee 就是當前執行函數的自身
document.writeln( arguments.callee === test ); // true
};
test();
// 輸出斐波那契數列(1,2,3,5,8,13……)第10項的數字
// 內部使用匿名函數+函數遞歸來實現
// 由于是匿名函數,在函數內部無法通過函數名來遞歸調用該函數
// 我們可以通過arguments.callee來取得當前匿名函數,從而進行遞歸調用
document.writeln(function(n){
if(n <= 2)
return n;
else
return arguments.callee(n - 1) + arguments.callee(n - 1);
}(10));
```