title: examining unknown number of inputs to a javascript function
body: <p>I am working with a very poorly documented javascript API, and need to write callback functions where the arguments have not been documented. As an opening step, I need to inspect what gets passed in. If I know that there's only one input I can set the callback function to be </p>
  
  <pre><code>function( stuff ){
      console.log(stuff);
  }
  </code></pre>
  
  <p>and work from there. Is there an elegant way to inspect inputs when I don't know how many there are? I could do something like</p>
  
  <pre><code>function(a,b,c,d,e,f){
      console.log(a) 
      console.log(b) // is this undefined?
      console.log(c) // how about now?
        ....
      console.log(f) // if this isn't undefined I need to do it again with more args
  }
  </code></pre>
  
  <p>and it will work fine, but it's pretty ugly. Is there a simpler way to find out how many argumetns have been passed to a function?</p>