Page 69 - Nodejs 교과서 개정2판
P. 69
(async () => {
for await (promise of [promise1, promise2]) {
console.log(promise);
}
})();
for await ofޙਸ ࢎਊ೧ࢲ ۽झ ߓৌਸ ࣽഥೞח ݽणੑפ async ೣࣻ ߈ജч ೦࢚ Promise۽ х
ऱפ ٮۄࢲ प೯ റ thenਸ ࠢѢա ژ ܲ async ೣࣻ উীࢲ awaitਸ ࠢৈࢲ ܻೡ ࣻ णפ
async function findAndSaveUser(Users) {
// 생략
}
findAndSaveUser().then(() => { /* 생략 */ });
// 또는
async function other() {
const result = await findAndSaveUser();
}
খਵ۽ غח ߔ ೣࣻо ݶ ۽झܳ Ѣ async await ޙߨਵ۽ ߄Բח োणਸ ೧ࠁӡ ߄ۉפ
٘о ഻ঁ рѾ೧ Ѫੑפ ଼ ઁח async await ޙߨਸ ӓਵ۽ ࢎਊೞ۽ ࣼ೧ח Ѫ
જणפ
৻ীب ݆ ޙߨ ୶оغणפ ೞ݅ ଼ীࢲח ਤীࢲ ࢸݺೠ ղਊ ب݅ ࢎਊפ ܲ
߸҃ ࢎ೦ ؊ ҾӘೠ ةٜਸ ਤ೧ ী ࢜۽ ޙߨਸ ߓ ࣻ ח ࢎ ݂ܳ য֬ওणפ
ઁ ۠ূ٘ীࢲ ࢎਊغח ߄झ݀ ٘ܳ ঌইࠁѷणפ