title: How to check if function exists in JavaScript?
body: <p>My code is</p>
  
  <pre><code>function getID( swfID ){
       if(navigator.appName.indexOf("Microsoft") != -1){
            me = window[swfID];
       }else{
            me = document[swfID];
       }
  }
  
  function js_to_as( str ){
       me.onChange(str);
  }
  </code></pre>
  
  <p>However, sometimes my <code>onChange</code> does not load. Firebug errors with</p>
  
  <blockquote>
    <p>me.onChange is not a function</p>
  </blockquote>
  
  <p>I want to degrade gracefully because this is not the most important feature in my program. <code>typeof</code> gives the same error.</p>
  
  <p>Any suggestions on how to make sure that it exists and then only execute <code>onChange</code>?</p>
  
  <p>(None of the methods below except try catch one work)</p>