title: How best to implement out params in JavaScript?
body: <p>I'm using Javascript with jQuery. I'd like to implement out params. In C#, it would look something like this:</p>
  
  <pre><code>/*
   * odp      the object to test
   * error    a string that will be filled with the error message if odp is illegal. Undefined otherwise.
   *
   * Returns  true if odp is legal.
   */
  bool isLegal(odp, out error);
  </code></pre>
  
  <p>What is the best way to do something like this in JS? Objects?</p>
  
  <pre><code>function isLegal(odp, errorObj)
  {
      // ...
      errorObj.val = "ODP failed test foo";
      return false;
  }
  </code></pre>
  
  <p>Firebug tells me that the above approach would work, but is there a better way?</p>