I want to call an async function inside for loop
function test(req,res){
//somelogic part here
async function create(data){
//logic part here
}
for( var value in values){
// some codeing part here
await create(data);
}
}
uncaughtException: await is only valid in async function
then I can't call an async function inside For loop. I know it is written like this but is there any possible way I can call an async function inside for loop
for await (var value in values)
asyncfunction. Also, error clearly states that. It will work inside async onlycreateis returning a value I see no reason to useasync/awaithere.