> 
> **Possible Duplicate:**  
> 
> [Get a function’s arity](https://stackoverflow.com/questions/4848149/get-a-functions-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

```