-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- 시작/제어 흐름/what-are-callbacks / – Maxim