-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