我迷失在回调中。代码和所需的输出如下。所以发生的事情是内部循环没有执行,应该打印@b array=> ['a','b','c']
Async = require('async')
@a = [1,2,3]
@b = ['a','b','c']
Async.forEachSeries @a, (aa , cbLoop1) =>
console.log aa
console.log "^ number from Loop-1"
Async.forEachSeries @b, (bb , cbLoop2) =>
#call the method below
Async.waterfall(
[
(cb) ->
#call method 'start'
#'start' method has a callback that gets info using HTTP GET
start bb , (error , response) ->
#console.log(response) or do something with response
cbLoop2()
]
)
cbLoop1()
# Desired OUTPUT
1
^ number from Loop-1
a
b
c
2
^ number from Loop-1
a
b
c
3
^ number from Loop-1
a
b
c