arguments.callee
arguments.callee は実行中の関数自身を参照するレガシーなプロパティです。strict モードでは禁止されており、名前付き関数式の使用が推奨されます。
概要
arguments.callee は実行中の関数自身を参照するレガシーなプロパティです。strict モードでは禁止されており、名前付き関数式の使用が推奨されます。
対応ブラウザ
| 機能 | デスクトップ | モバイル | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 1 | 12 | 1 | 1 | 18 | 1 | |
基本構文
JAVASCRIPT
// arguments.callee example
// See MDN Web Docs for details ライブデモ
Recursive call with arguments.callee
Use the legacy recursive pattern inside a non-strict function expression.
JavaScript
出力
「実行」ボタンを押してください
Anonymous function recursion
Show how arguments.callee was used before naming the function directly.
JavaScript
出力
「実行」ボタンを押してください
Compare with a named function
Contrast the legacy pattern with the modern named-function approach.
JavaScript
出力
「実行」ボタンを押してください
実務での使いどころ
-
arguments.callee の活用
実行中の関数自身への参照(非推奨)。strict モードでは使用不可。名前付き関数式を代替に使用。
注意点
- 一部のブラウザでのみ対応。使用前にブラウザサポートを確認すること。
アクセシビリティ
- JavaScript による動的更新時は、aria-live リージョンで変更をスクリーンリーダーに通知する。
参考リンク
Powered by web-features