How to programmatically set the length of a function
<p>The <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/length" rel="nofollow"><code>length</code> property of functions</a> tells how long the 'expected' argument list is:</p>

<pre><code>console.log((function () {}).length);  /* 0 */
console.log((function (a) {}).length); /* 1 */
console.log((function (a, b) {}).length); /* 2 etc. */
</code></pre>

<p>However, it is a readonly method:</p>

<pre><code>f = function (a) {};
alert(f.length); // 1
f.length = 3;
alert(f.length); // 1
</code></pre>

<p>Is there a way to programmatically set that length? The closest I've come so far is to use the Function constructor:</p>

<pre><code>f = new Function("a,b,c", "/* function body here */");
f.length; // 3
</code></pre>

<p>However, using Function is essentially the same as <code>eval</code> and we all know how bad that is. What other options do I have here?</p>
