티스토리 뷰

🌈 JavaScript

Array 중복 제거

James Wetzel 2023. 1. 10. 14:53
confirmDelivery: async function () {
    var selectedPackingNo = [];
    var failure = [];
    const distinctPackingNo = Array.from(new Set(selectedPackingNo));

    for (const value of distinctPackingNo) {
        if (await Page.confirmDeliverySync(value) == "Failure") {
            failure.push(value);
        }
    }

    if (failure.length > 0) {
        UIUtil.alert(String.format("There are some delivery confirm error<br>error packing[{0}]", failure.toString()));
    } else {
        UIUtil.alert("Success");
    }
},
confirmDeliverySync: async function (packingNo) {
    var result = await RMSHelper.callWebMethodAsync();

    if (result != null && result.ResultCode == 0) {
        return "Success";
    } else {
        return "Failure";
    }
}

 

forEach문에서 await가 동작하지 않는 이유와 해결책

참조 사이트 : https://constructionsite.tistory.com/43

반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함