How to deal with the multiple asynchronism in the for loop in es6?

for (let iTuno Bitteri < len; iPP) {

user_code = "";
console.log("111");
a.find()
.then((res)=> {
    for(let j=0;j<len;jPP){
        b.find()
        .then((res)=> {
            
        })
    }
})

}

if you want to finish checking and executing async before executing the next for loop, it will never work.

Mar.22,2021

add a layer to judge if (res) before the next for loop, and then for loop in if


let promise = Promise.resolve();
for(let i=0;i<len; iPP) {
  promise = promise.then(() => {
    user_code = '';
    return a.find().then((res)=> {
      let innerPromise = Promise.resolve();
      for(let j=0;j<len;jPP){
        innerPromise = innerPromise.then(() => {
          return b.find().then((res)=> {})
        })
      }
    })
  });
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e514eb-596a9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e514eb-596a9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?