title: ES6 class variable alternatives
body: <p>Currently in ES5 many of us are using the following pattern in frameworks to create classes and class variables, which is comfy:</p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>// ES 5
  FrameWork.Class({
  
      variable: 'string',
      variable2: true,
  
      init: function(){
  
      },
  
      addItem: function(){
  
      }
  
  });
  </code></pre>
  
  <p>In ES6 you can create classes natively, but there is no option to have class variables:</p>
  
  <pre class="lang-js prettyprint-override"><code>// ES6
  class MyClass {
      const MY_CONST = 'string'; // &lt;-- this is not possible in ES6
      constructor(){
          this.MY_CONST;
      }
  }
  </code></pre>
  
  <p>Sadly, the above won't work, as classes only can contain methods. </p>
  
  <p>I understand that I can <code>this.myVar = true</code> in <code>constructor</code>…but I don't want to 'junk' my constructor, especially when I have 20-30+ params for a bigger class.</p>
  
  <p>I was thinking of many ways to handle this issue, but haven't yet found any good ones. (For example: create a <code>ClassConfig</code> handler, and pass a <code>parameter</code> object, which is declared separately from the class. Then the handler would attach to the class. I was thinking about <code>WeakMaps</code> also to integrate, somehow.)</p>
  
  <p>What kind of ideas would you have to handle this situation?</p>