const ratings = [5, 4, 5];
let sum = 0;

const sumFunction = async (a, b) => a + b;

ratings.forEach(async (rating) => {
  sum = await sumFunction(sum, rating);
});

console.log(sum);
// 순진하게 예상한 출력: 14
// 실제 출력: 0

async , await 강조 4,6-7 라인

선택 삭제 전체 선택

List of Articles
번호 제목 글쓴이 날짜 조회 수
71 121 file socialskyo 2023.05.17 9
70 123 324 2024.05.26 8
69 5월 12일 1 공이로비 2023.05.12 16
68 aa socialskyo 2024.06.05 8
67 aaa socialskyo 2023.05.13 13
66 asdf! file ! 2024.06.10 6
65 ChatGPT 1 테스트 2023.07.06 59
64 ChatGPT 테스트 - 본문글에 답변하기 2 xeplus 2023.04.28 20
63 Dndndnd file Ejejej 2024.06.04 7
62 dsa 3 dsad 2023.05.12 18
61 HTML5에 대해 설명해줘 2 손님 2023.05.10 33
60 map gpt ㅁㄴㅇㄹ 2023.06.12 29
59 test ㅎㅎㅎ 2024.02.20 10
58 test mumu 2024.02.21 9
57 TO-DO xeplus 2023.04.25 10
56 URL 정보 file xeplus 2023.04.24 26
55 werwer 2 바보 2024.05.28 11
54 ㄱㄱ 1 ㅇㅇ 2024.04.25 13
53 각주 테스트 xeplus 2023.05.02 25
52 너무 쓰고싶은 에디터ㅠ 7 안녕하세요 2023.12.20 91
목록
Board Pagination Prev 1 2 3 4 Next
/ 4
서버에 요청 중입니다. 잠시만 기다려 주십시오...