title: Mapping an Array Based on Another Array
body: <p>I'm working on a project where I need to change the values of one array should the first index of one of its nested arrays be found within the second array. For example:</p>
  
  <p><strong>Array One</strong></p>
  
  <pre><code>[12345, [67890, 1], [09876, 2]]
  </code></pre>
  
  <p><strong>Array Two</strong></p>
  
  <pre><code>[
     [
        180547,
        '180547 text',
        'more text',
        ...etc
     ], [
        67890,
        '67890 text',
        'more text',
        ...etc
     ],
     ...etc
  ]
  </code></pre>
  
  <p>I need to iterate through each of the nested arrays in <code>Array One</code> and check if the first value in each nested array is present in the any of the arrays in <code>Array Two</code>. From there, I need to copy <code>Array Two</code>'s array, and replace the first value of the nested array in <code>Array One</code>.</p>
  
  <p>I know that was probably a little confusing, so here's an example output of the above arrays:</p>
  
  <p><strong>Output</strong></p>
  
  <pre><code>[12345, [[67890, '67890 text', 'more text', ...etc], 1], [09876, 2]]
  </code></pre>
  
  <p>ES6+ is preferred, but not necessary.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>As asked for, so given -</p>
  
  <p>Function jargon aside, here's the best I was able to come up with on my own:</p>
  
  <pre><code>  gid.steal()
      .then(dataset =&gt; {
        let o = dataset.forEach(group =&gt; {
          group.map((person, i) =&gt; {
            i === 0 ? person : rows.forEach(row =&gt; {
              row[0] === person[0] &amp;&amp; row[row.length - 1] === '-3' ? [row, person[1]] : null
            })
          })
        })
  
        console.log(o)
      })
      .catch(err =&gt; rej(err))
  //dataset would be Array One and rows would be Array Two
  </code></pre>
  
  <p>This returns <code>undefined</code></p>
  
  <p>I have a feeling I'm either trying to get too complicated/clever with it, or I'm totally out of bounds on this method.</p>