| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Function/arguments | [Back] [Original] |
Get to know MDN better
Avoid using this feature in new projects.
JavaScript strict mode prohibits accessing the caller and arguments properties of a Function object.
This feature may be a candidate for removal from web standards or browsers.
:
arguments
f f.arguments
arguments null
ECMAScript Function.prototype arguments get set TypeErrorarguments Chrome Firefox Safari Function.prototype.arguments this
(function f() {
if (Object.hasOwn(f, "arguments")) {
console.log(
"arguments ",
Object.getOwnPropertyDescriptor(f, "arguments"),
);
} else {
console.log(
"f arguments f.[[Prototype]].arguments",
);
console.log(
Object.getOwnPropertyDescriptor(
Object.getPrototypeOf(f),
"arguments",
).get.call(f),
);
}
})();
// Chrome
// arguments {value: Arguments(0), writable: false, enumerable: false, configurable: false}
// Firefox
// f arguments f.[[Prototype]].arguments
// Arguments { }
function f(n) {
g(n - 1);
}
function g(n) {
console.log(`${g.arguments[0]}`);
if (n > 0) {
f(n);
}
console.log(`${g.arguments[0]}`);
}
f(2);
console.log(`${g.arguments}`);
//
// 1
// 0
// 0
// 1
// null
FunctionObject/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()| Web Proxy Viewer | New URL | Original Page |