title: Is there a better way to do optional function parameters in JavaScript?
body: <p>I've always handled optional parameters in JavaScript like this:</p>
  
  <pre><code>function myFunc(requiredArg, optionalArg){
    optionalArg = optionalArg || 'defaultValue';
  
    // Do stuff
  }
  </code></pre>
  
  <p>Is there a better way to do it?</p>
  
  <p>Are there any cases where using <code>||</code> like that is going to fail?</p>