title: Why doesn't merging a prototype to another object via Object.assign() work?
body: <p>So I have this <code>class</code> definition:</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 Field {
      constructor(canvas) {
          const CANVAS = document.querySelector(canvas);
          const CONTEXT = CANVAS.getContext("2d");
  
          return Object.assign(CONTEXT, Field.prototype); // *
      }
  
      prototypeMethodName() {
          return "something";
      }
  }
  
  console.log(new Field("canvas"));</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;canvas&gt;&lt;/canvas&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The main idea here is that when I invoke <code>new Field()</code> I get not the instance of <code>Field</code>, but the object consisting of two other objects: <code>CONTEXT</code> and <code>Field.prototype</code>. The <code>CONTEXT</code> is the instance of the <code>CanvasRenderingContext2D</code>, and, basically, I just want to augument it with other methods (in this example it's just one method <code>prototypeMethodName()</code>).</p>
  
  <p>But in this case I get a bare <code>CONTEXT</code> object that doesn't contain any of "my" properties.</p>
  
  <p>I also noticed that the <code>assign</code> method doesn't work correctly only when I'm trying to merge a prototype of something to the tatget object. So the thing here is not about the <code>CONTEXT</code> object, but is about the prototype.</p>
  
  <p>Why doesn't my code work? What would I do to make it work then?</p>