Front End/🌈 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가 동작하지 않는 이유와 해결책
728x90
반응형