title: How do I pass multiple arguments into a javascript callback function?
body: <p>Javascript code:</p>
  
  <pre><code>function doSomething(v1,v2){ //blah; }
  
  function SomeClass(callbackFunction,callbackFuncParameters(*Array*))={
     this.callback = callbackFunction;
     this.method = function(){
         this.callback(parameters[0],parameters[1])  // *.*
     }
  }
  
  var obj = new SomeClass( doSomething, Array('v1text','v2text') );
  </code></pre>
  
  <p>The problem is if I change function doSomething to </p>
  
  <pre><code>function doSomething(v1,v2,v3){ //blah; }
  </code></pre>
  
  <p>I have to change the corresponding line (marked as <code>//*.*</code>) in <code>SomeClass</code> to </p>
  
  <pre><code>this.callback(parameters[0],parameters[1],parameters[2]);
  </code></pre>
  
  <p>What can be done to avoid the <code>(*.*)</code> line to be changed no matter how the number of 'doSomething' function's parameters is changed? </p>
  
  <p>Thanks a lot!</p>