Possible Duplicate:
Get a function’s arity
How can I declare a function expression, pass it into a defined function, and have the defined function determine how many arguments the function expression has?
See this code snippet for reference:
function getArgumentCount(fexp)
{
return ...;
}
var fexp1 = function(a) { };
var fexp2 = function(a, b) { };
console.log(getArgumentCount(fexp1)); // Should output 1
console.log(getArgumentCount(fexp2)); // Should output 2