-2
我在调用另一个函数(内部函数)中的函数,并且我需要out函数的内部函数的结果。Node.js多个函数调用
例子:
var value;
database.query1(param1, param2, function(err, outerResults) {
if (outerResults == null) {
database.query2(params1, params2, function(err, innerResults) {
value = innerResults;
});
console.info(value); // I am not able to get the value of this innerResults outside the function
}
});
https://docs.nodejitsu.com/articles/getting-开始/控制流/什么 - 是 - 回调/ – Maxim