title: How to spread an object into a classes properties in JavaScript
body: <p>Basically here's what I'm trying to accomplish.</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>class Person {
    constructor (obj) {
      this.first = ''
      this.last = ''
      this.age = ''
  
      if (obj) {
        Object.assign(this, ...obj)
      }
    }
  }
  
  const a = new Person()
  console.log('Not spreading: ', a)
  
  const b = new Person({ first: 'Alex', last: 'Cory', age: 27 })
  console.log('Spreading: ', b)</code></pre>
  </div>
  </div>
  </p>
  
  <p>Is there a way to spread an object like this to populate a class?</p>