【发布时间】:2021-02-13 17:36:21
【问题描述】:
我有一个数组映射,我需要在完成映射后执行一些代码。
这里是数组映射代码
studentList.map( async index => {
try{
const student = await User.findOne({indexNumber: index})
if (student == null) {
emptyStudents.push(index)
}
}
catch(err){
console.log(err)
}
})
我该怎么做?由于这是异步的,我无法找到解决方案。
【问题讨论】:
标签: node.js arrays asynchronous