だから、私はこの NodeJS コードを持っています:
for(var i = 0; i < subcats.length; i++) {
subcats[i].getChallenges(function(challenges) {
this.challenges = challenges;
if(index == subcats.length - 1)
res.render('challenges/category', {'category': category, 'subcats': subcats});
});
}
問題は、getChallenges が関数を呼び出すまでにインデックスが限界点に達し、最後の getChallenge コールバックでのみ res.render を呼び出す必要があることです。これを行う方法はありますか?ありがとう!!!