title: ES6 Classes Default Value
body: <p>Is it possible to create a ES6 class, that assigns a default value to a property if it's not passed in the new method?</p>
  
  <pre><code>class myClass {
      constructor(options) {
          this.a = typeof options.a !== 'undefined' ? options.a : 'default a value';
          this.b = typeof options.b !== 'undefined' ? options.b : 'default b value';
          this.c = typeof options.c !== 'undefined' ? options.c : 'default c value';
      }
  }
  
  var myClassWithValue = new myClass({a:'a value', b: 'b value'});
  </code></pre>
  
  <p>If I try to do this with this code, compiling with babeljs, I get a TypeError: Cannot set property 'c' of undefined. </p>
  
  <p>Maybe I am not getting how classes work in javascript.</p>