Relative Content

Tag Archive for javascriptasync-await

I want to wait all async task complete -> TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

let status = [] const promises = files.forEach(async (file) => { let path = ${localPath}/${file} let info = await imagepredictions(path) let flag = await fileUpload(info, req, path)console.log(“flag”, flag); if (flag) { status.push(info ? info : null) } console.log(“INSIDE “,status);return info, flag;}) await Promise.all(promises); console.log(“outside “,status); console.log(“outside “,status); ** –> I want to wait all async […]

Javascript – Await not waiting in async function returning a promise

I’ve recently started learning javascript and I’m having a big problem understanding the async behavior of the language. I’ve spent hundreds of hours searching and everyone recommends the use of promises but I can’t quite comprehend what I’m doing wrong (maybe all of it lol).