title: Javascript: Forwarding function calls that take variable number of arguments
body: <p>I think I need something like ruby's splat <code>*</code> here.</p>
  
  <pre><code>function foo() {
    var result = '';
    for (var i = 0; i &lt; arguments.length; i++) {
      result += arguments[i];
    }
    return result;
  }
  
  function bar() {
    return foo(arguments) // this line doesn't work as I expect
  }
  
  bar(1, 2, 3);
  </code></pre>
  
  <p>I want this to return <code>"123"</code>, but instead I get <code>"[object Arguments]"</code>.  Which makes sense, I suppose.  It's passing the object that represents the arguments, but not the arguments individually.</p>
  
  <p>So how do I simply forward any number of arguments to another function that takes any number of arguments?</p>