title: Set a default value for a boolean parameter in a javascript function
body: <p>I have used <code>typeof foo !== 'undefined'</code> to test optional parameters in javascript functions, but if I want this value to be <code>true</code> or <code>false</code> every time, what is the simplest or quickest or most thorough way? It seems like it could be simpler than this:</p>
  
  <pre><code>function logBool(x) {
      x = typeof x !== 'undefined' &amp;&amp; x ? true : false;
      console.log(x);
  }
  
  var a, b = false, c = true;
  logBool(a); // false
  logBool(b); // false
  logBool(c); // true
  </code></pre>