需求:
要赋值的变量是 last_id
function foo() {
var last_id = 'AAAA'
// mongodb Model
ItemModel.find((err, items) => {
last_id = 'BBBB'
console.log(`LOG_1: ${last_id}`) // [结果正确]: BBB
})
console.log(`LOG_2: ${last_id}`) // [结果不是想要的]: AAA
}
问题:
如何解决?
可参考文档?
慕婉清6462132
呼如林
随时随地看视频慕课网APP
相关分类