title: javascript: determine functions return type
body: <p>Is there a way in javascript to determine the return type(if any) of a function?</p>
  
  <p>example:</p>
  
  <pre><code>function doSomething(){
     return true;
  }
  </code></pre>
  
  <p>to returned type is boolean.</p>
  
  <p>example 2:</p>
  
  <pre><code>function doSomething2(x){
      if(x=="a") return 1;//number
      else return "bad x"; //string
  }
  </code></pre>