I have a API call to update a record in a loop. I want to have a promise around API call so that the next iteration is not called until the first is finished. How can I achieve this?
I have tried this but this gives an error "Can not use keyword 'await' outside an async function"
async saveMyData(){
this.elements.forEach(element => {
await this.$refs.DM.saveInternalData(element)
})
}