Is it possible to get function arguments count from external scope?
var foo = function(a,b,c) {
}
alert(foo.arguments.length); // how to do it? possible?
You want Function.length:
function test(a, b, c) {
// code
}
console.log(test.length); // 3
BTW, the number of expected arguments of a function is called the arity. There used to be a method called Function.arity but was deprecated in favour of Function.length.
try foo.length. It gives no of parameters defined in function definition.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With