title: How to use Node.js nested Async forEachSeries loop
body: <p><em>Using coffeescript to code</em>
  <a href="https://stackoverflow.com/questions/13690622/node-js-callbacks-async-foreach-nested-loop-with-waterfall-flow">One solution | see this post</a></p>
  
  <p>I have two loops. I want to take each value from array 'a' and then loop through all the values of 'b' process them and move to next value in array 'a'</p>
  
  <p>output expected:</p>
  
  <pre><code>1 a b c
  2 a b c
  3 a b c
  </code></pre>
  
  <p>Error I see: </p>
  
  <pre><code> [ 1, 2, 3 ]
  
   [ 'a', 'b', 'c' ]
  
   1
   2
   3
  
   TypeError: Cannot read property 'length' of undefined
     at Object.forEachSeries(~/src/node_modules/async/lib/async.js:103:17)
  
  
  
  
    Async = require('async')
  
    @a = [1,2,3]
    @b = ['a','b','c']
  
    console.dir @a
    console.dir @b
  
    Async.forEachSeries @a, (aa , cbLoop1) -&gt;
      console.log aa
      cbLoop1()
      Async.forEachSeries @b, (bb , cbLoop2) -&gt;
        #here will be some callback that I need to process before moving to next value in
        #b array
        console.log bb
        cbLoop2()
  </code></pre>