arguments
objectarguments.length
argLength('foo', 'bar')
→ argLength('foo', 'bar', 1, 2, 3)
→ argLength(new Array('foo', 'bar'))
→ argLength(1, 2, 3)
→ Function.arguments.length
funcArgLength('foo', 'bar')
→ for (var i = 0; i < arguments.length; i++)
forNormalLoop('foo', 'bar', 'baz');
for (arg in arguments)
forInArgs('foo', 'bar', 'baz');
This should not create a list, because all properties have { DontEnum }
as an attribute.
arguments.callee
Handy for recursive functions.
Math.fact = function(i) {
if (i > 0) {
return i * arguments.callee(i - 1);
} else {
return 1;
}
}
Math.fact(4)
→ Math.fact(10)
→ Math.fact(99)
→ Math.fact(3)
→ Math.fact()
→