| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Functions/arguments/callee | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
Avoid using this feature in new projects.
JavaScript strict mode prohibits accessing arguments.callee.
This feature may be a candidate for removal from web standards or browsers.
arguments.callee (property) .
callee arguments . (body) . , ( " " ) .
arguments.callee ES5 ?JavaScript (named) . (recursive) .
, :
function factorial(n) {
return !(n > 1) ? 1 : factorial(n - 1) * n;
}
[1, 2, 3, 4, 5].map(factorial);
:
[1, 2, 3, 4, 5].map(function (n) {
return !(n > 1) ? 1 : /* what goes here? */ (n - 1) * n;
});
. arguments.callee
[1, 2, 3, 4, 5].map(function (n) {
return !(n > 1) ? 1 : arguments.callee(n - 1) * n;
});
, . ( arguments, callee caller ) tail (tracing .) this . :
var global = this;
var sillyFunction = function (recursed) {
if (!recursed) {
return arguments.callee(true);
}
if (this !== global) {
alert("This is: " + this);
} else {
alert("This is the global");
}
};
sillyFunction();
ECMAScript 3 (named) . :
[1, 2, 3, 4, 5].map(function factorial(n) {
return !(n > 1) ? 1 : factorial(n - 1) * n;
});
:
arguments.callee.caller Function.caller. ? , caller : . , f (unknown) , f . guard :
function f(a, b, c, d, e) {
return a ? b * c : d * e;
}
JavaScript , . . . .
arguments.callee . , . , ( Function ) . , arguments.callee .
function create() {
return function (n) {
if (n <= 1) return 1;
return n * arguments.callee(n - 1);
};
}
var result = create()(5); // 120 (5 * 4 * 3 * 2 * 1)
arguments.callee , arguments.callee . (deprecation) (Firefox bug 725398 ):
function createPerson(sIdentity) {
var oPerson = new Function("alert(arguments.callee.identity);");
oPerson.identity = sIdentity;
return oPerson;
}
var john = createPerson("John Smith");
john();
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-arguments-exotic-objects |
This page was last modified on 2024 12 17 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |