【发布时间】:2020-05-25 03:25:38
【问题描述】:
我有以下几点:
result = foobar(randInt, function(err, result){
})
console.log(result);
foobar 函数由此从外部 api 获得随机响应。
这样写代码可以输出结果
result = foobar(randInt, function(err, result){
console.log(result);
})
它会输出结果,但如果我这样写
result = foobar(randInt, function(err, result){
})
console.log(result);
我收到undefined
如何访问函数的结果以便以后处理它
例如result += ' accepted
【问题讨论】:
标签: javascript node.js