title: javascript nested foreach loops and this
body: <p>I have nested foreach loops and I want to access the index of the parent within the child. Normally I would know how to do this but I have abstracted* the callback functions so I can use them in other parts of my program. 
  I assume this has something to do with <code>this</code> but I can't figure it out.</p>
  
  <p>*what is the right word here?</p>
  
  <p>the following code is what I have tried</p>
  
  <pre><code>const processChildArray = function( value, index ){
      console.log( `${this.index} ${index} ${value}` );
  }
  
  const processParentArray = function( value, index ){
      value.childArray.forEach( processChildArray, this )
  }
  
  parentArray.forEach( processParentArray );
  </code></pre>
  
  <p>but it says index is undefined</p>