title: When should I use ?? (nullish coalescing) vs || (logical OR)?
body: <p>Related to <a href="https://stackoverflow.com/questions/476436/is-there-a-null-coalescing-operator-in-javascript">Is there a &quot;null coalescing&quot; operator in JavaScript?</a> - JavaScript now has a <code>??</code> operator which I see is in use more frequently. Previously most JavaScript code used <code>||</code>.</p>
  
  <pre class="lang-js prettyprint-override"><code>let userAge = null
  
  // These values will be the same. 
  let age1 = userAge || 21
  let age2 = userAge ?? 21
  </code></pre>
  
  <p><strong>In what circumstances will <code>??</code> and <code>||</code> behave differently?</strong></p>