Get number of arguments in function expression?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4848149/get-a-functions-arity">Get a function’s arity</a>  </p>
</blockquote>



<p>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?</p>

<p>See this code snippet for reference:</p>

<pre><code>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
</code></pre>
