Because arguments.length property is non-enumerable.
You can define a property on an object and set its enumerable attribute to false, like this
var obj = {};
Object.defineProperty(obj, "name", {
"value": "a",
enumerable: false
});
console.log(obj);
// {}
You can check the same with Object.prototype.propertyIsEnumerable function, like this
function testFunction() {
console.log(arguments.propertyIsEnumerable("length"));
}
testFunction();
would print false, because length property of arguments special object is not enumerable.
If you want to see all the properties, use the answers mentioned in this question. Basically, Object.getOwnPropertyNames can enumerate even the non-enumerable properties. So, you can use that like this
function testFunction() {
Object.getOwnPropertyNames(arguments).forEach(function (currentProperty) {
console.log(currentProperty, arguments[currentProperty]);
});
}
testFunction();
this would print the length and the callee properties.