Cycles in nodejs, how to implement?

How to implement loops in nodejs, in some cases it is better to use a promise, callback, closures and async?
And whether this form of execution of sequential functions using promises?
June 5th 19 at 21:10
2 answers
June 5th 19 at 21:12
Not quite understand the question.
If you are doing an asynchronous call, you use promise. If not - don't use.

An example of serial operations you also incorrectly written. Will correct this:

 .then(data => {
 return getData2(data);
 .then(data => {
 return getData3(data)
Thank You...)) Understood)) - Mckenzie_Ebert48 commented on June 5th 19 at 21:15
June 5th 19 at 21:14
let data = await getData1()
data = await getData2(data)
data = await getData3(data)

Find more questions by tags Node.js