title: JS Object.assign with own classes as properties
body: <p>I am looking for an alternative equivalent solution for this jQuery-expression:</p>
  
  <pre><code>$.extend(true, {}, {foo: "bar"}, {bar: "foo"});
  </code></pre>
  
  <p>I am using Babel with ES_2015 and polyfill. For now I was assuming, that it is possible to use</p>
  
  <pre><code>Object.assign({}, {foo: "bar"}, {bar: "foo"});
  </code></pre>
  
  <p>In my case this is not what I was looking for, as I found out, that when a property is my own Class, that does not work.</p>
  
  <p>For example</p>
  
  <pre><code>let a = {origin: new Point(0,0), sizes: new Point(100, 100)};
  let b = {origin: new Point(50,50), sizes: new Point(200, 200)};
  
  Object.assign({}, a, b);
  </code></pre>
  
  <p>It does not copy my Point class. Is there any other solution, leaving jQuery out?</p>
  
  <p>Best regards,</p>
  
  <p>Michael</p>
  
  <p><strong>edit2: Bergi was right, I got confused myself. I will do some testing, but for now its seems fine. Maybe I have a larger issue elsewhere in my code. Will get back to you. Thx so far folks</strong>
  <strong>edit, so nobody gets confused:</strong></p>
  
  <p>I NEED an instance of Point. Not an object.</p>
  
  <pre><code>    /*global Point*/
  describe('Object.assign', function() {
      "use strict";
  
      it("Point", function() {
          let a = {
              origin: new Point.Point(0, 0),
              sizes: {
                  x: new Point.Point(100, 100),
                  y: new Point.Point(500, 500)
              }
          };
          let b = {
              origin: new Point.Point(50, 50),
              sizes: {
                  x: new Point.Point(1000, 1000),
                  y: new Point.Point(5000, 5000)
              }
          };
          var s = Object.assign({}, a, b);
          console.log(typeof s.origin, s.origin instanceof Point.Point);
          console.log(typeof s.sizes.x, s.sizes.x instanceof Point.Point);
          console.log(typeof s.sizes.y, s.sizes.y instanceof Point.Point);
  
          console.log(s.sizes.y.clone, s.sizes.x.clone);
  
      });
  
  });
  </code></pre>
  
  <p>So in the end, I want s instanceof Point to be true ;)</p>