title: Passing undefined parameter to function - check if variable exists
body: <p>Consider the following Javascript:</p>
  
  <pre><code>function getType(obj){
      return(typeof(obj))
  }
  alert(typeof(obj))  //alerts "undefined" correctly
  alert(getType(obj))   //throws an error: ReferenceError: obj is not defined
  </code></pre>
  
  <p>Why might this be happening? Is there any workaround? I am trying to write a function which checks if a variable exists.</p>