title: JavaScript: Using `this` with prototype and arrow functions in ES6
body: <p>I have a simple prototypal inheritance constructor, which I'm using arrow functions for.</p>
  
  <pre><code>app.Node = function (name, type) {
      this.name = name;
      this.type = type;
      this.children = [];
  }
  
  app.Node.prototype = {
      addChild: (child)=&gt;{
          child._parent = this;
          this.children.push(child);
      },
      removeChild: (child)=&gt;{
          this.children.forEach((item, i) =&gt; {
              if (item === child) {
                  this.removeChildAtIndex(i);
              }
          });
      },
  }
  </code></pre>
  
  <p>However, due to the nature of <code>this</code> and arrow functions, the value of <code>this</code> is <code>undefined</code> within the prototype methods above. So am I able to use arrow functions in this way? I can't figure out what I'd need to change, other than to use normal <code>function</code> functions.</p>