Hello im trying to loop throught an array with the
I tried to make the forEach loop Async
content.forEach(asnyc(element) => {
console.log(func(element)
})
This gave me a syntax error stating that it expects a , forEach statement like this
content.forEach(element => {
console.log(func(element)
})
The func will return a promise and currently I need to find a way to await it
the function this code is running in is Async And im perfectly able to await a promise in it However in a forEach loop it doesnt seem to work
I tried to do the following
content.forEach(element => {
console.log(await func(element)
})
SyntaxError: await is only valid in async functions and the top level bodies of modules
I tried to make the forEach loop Async
content.forEach(asnyc(element) => {
console.log(func(element)
})
This gave me a syntax error stating that it expects a ,