How to pass all arguments as collection to another function and not as single argument?
<p>I have a function that accepts any number and kind of arguments, so no specific parameter has been defined. This function should call another function passing all arguments.</p>

<p>The problem is that I can pass "arguments" in order to include all arguments but in this case it will work like a single argument and not the way we expect arguments to work.</p>

<p>An example:</p>

<p>The main function:</p>

<pre><code>function handleCall() {
   // let's call a sub-function
   // and pass all arguments (my question is how this is handled the right way)
   function callSubFunction( arguments );
}

function callSubfunction( userid, customerid, param) {
   // passed arguments are now 
   alert( 'userid = ' + userid );

   // this will not work, you have to use arguments[2]
   alert( param );
  }

The example call:

handleCall( 1029, 232, 'param01' );
</code></pre>

<p>Using the approach above, all arguments will be stored in "userid" as pseudo-array and items can be accessed e.g. arguments[2] but not using the parameter name "param".</p>

<p>In ColdFusion, the solution for such stuff is the parameter "argumentCollection", this way you can pass parameters stored in a structure without being converted to a single argument with the type struct containing all key/values.</p>

<p>How can I achieve the same with JavaScript?</p>
