Object.keys will only list enumerable properties. The arguments property is not enumerable, as you can see if you use getOwnPropertyDescriptor.
The property exists, but
function f() {
}
console.log(Object.getOwnPropertyDescriptor(f, 'arguments'));
To get a list of all own-property keys (excluding symbols), including non-enumerable ones, you can use Object.getOwnPropertyNames.
function f() {
}
console.log(Object.getOwnPropertyNames(f));
which, here, gives you
[
"length",
"name",
"arguments",
"caller",
"prototype"
]
Object.keys could have returned properties if any properties put directly on the function were enumerable, such as
function f() {
}
f.someProp = 'foo';
console.log(Object.keys(f));
f.argumentsshould not exist, it's deprecated and accessing it in strict mode will throw