0
我有僞碼 -如何處理嵌套的包含利用回調sails.js每個循環
foreach(clients){
foreach(orderids)
{
//call asynchronous findOne()
if(client_Has_OrderId){
count++;
}
}//close foreach orderids
storeInArray(client,count);
}//close client foreach loop
我在sails.js新的,不知道如何在sails.js代碼這個我沒有異步編程的經驗。當我以同步方式編碼時,結果不會得到。
結果應該喜歡 -
client1 1
client2 5
client3 0
謝謝。
你可以使用異步()或無極[藍鳥。這不是一個sails.js問題 – Makah