title: How do you implement a guard clause in JavaScript?
body: <p>I want to guard my functions against null-ish values and only continue if there is "defined" value.</p>
  
  <p>After <a href="http://eloquentjavascript.net/chapter2.html" rel="noreferrer">looking</a> <a href="https://stackoverflow.com/questions/27509/detecting-an-undefined-object-property-in-javascript/27517#27517">around</a> the solutions suggested to double equal to undefined: <code>if (something == undefined)</code>. The problem with this solution is that you can declare an undefined variable. </p>
  
  <p>So my current solution is to check for null <code>if(something == null)</code> which implicetly checks for undefined. And if I want to catch addionalty falsy values I check <code>if(something)</code>. </p>
  
  <p>See tests here: <a href="http://jsfiddle.net/AV47T/2/" rel="noreferrer">http://jsfiddle.net/AV47T/2/</a></p>
  
  <p>Now am I missing something here?</p>
  
  <p>Matthias</p>