title: Spreading undefined in array vs object
body: <p>Why does spreading undefined in an object return an empty object? <code>{...undefined} // equals {}</code>:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>console.log({...undefined})</code></pre>
  </div>
  </div>
  </p>
  
  <p>And Why does spreading undefined in an array give you an error?
  <code>[...undefined] // type error</code>:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>console.log([...undefined])</code></pre>
  </div>
  </div>
  </p>