title: How do I pair arrays with the first one being a normal array and second one an array of arrays in JavaScript?
body: <p>Given the following arrays:</p>
  <pre><code>var arr1 = ['A','B','C'];
  var arr2 = [['D','E','F']['G','H','I']]
  </code></pre>
  <p>The output should be:</p>
  <pre><code>['ADG','ADH','ADI','AEG','AEH','AEI','AFG','AFH','AFI','BDG','BDH','BDI'.....]
  </code></pre>
  <p>But it should also be dynamic so that if another array is added to arr2 it should pick that as well.</p>
  <p>This is what I currently have:</p>
  <pre><code>const arrays = (arr1 = [], arr2 = [],arr3 = []) =&gt; {
  
    // var arr3 = arr2.slice(3);
    const res = [];
    for(let i = 0; i &lt; arr1.length; i++){
      for(let j = 0; j &lt; arr2.length; j++){
        for(let s=0;s&lt;arr3.length;s++){
          res.push(arr1[i] + arr2[j] + arr3[s] );
        }
      }
    }
  
    return res;
  };
  </code></pre>
  <p><a href="https://i.stack.imgur.com/JtfD9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JtfD9.png" alt="screenshot" /></a></p>