title: Composition and Mixins with JavaScript
body: <p>I am learning about compositions in Javascript. So I want to ask if this is correct way of doing things. </p>
  
  <p>I made some exercises that look like this:</p>
  
  <pre><code>    class Animal {
      // constructor() {
      // }
      eat = () =&gt; {
          console.log("this creature is eating");
      }
  }
  
  const AnimalsWithWings = superclass =&gt; class extends superclass {
      constructor(Feathers, ...args) {
          super(...args);
          Object.assign(this, { Feathers });
      }
  }
  
  const CanDive = superclass =&gt; class extends superclass {
      // constructor( ...args) {
      //     super(...args);
      // }
      dive = () =&gt; {
          console.log("Can Dive");
      }
  }
  
  class Duck extends AnimalsWithWings(CanDive(Animal)) {
      constructor(eats, ...args) {
          super(...args);
          Object.assign(this, { eats });
      }
  }
  
  const duffy = new Duck("watermelon", true);
  console.log(duffy);
  
  duffy.dive();
  duffy.eat()
  </code></pre>
  
  <p>I am still in learning process so I just need some pointers.</p>