File tree Expand file tree Collapse file tree 4 files changed +6
-6
lines changed
1-js/11-async/03-promise-chaining Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1- 답은 ** "같지 않다" ** 입니다 .
1+ 두 코드는 다르게 동작합니다 .
22
33` f1 ` 에서 에러가 발생하면 아래 코드에서는 ` .catch ` 에서 에러가 처리됩니다.
44
Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ fetch('/article/promise-chaining/user.json')
249249 })
250250 .then (function (text ) {
251251 // 원격에서 받아온 파일의 내용
252- alert (text); // {"name": "iliakan ", "isAdmin": true}
252+ alert (text); // {"name": "Violet-Bora-Lee ", "isAdmin": true}
253253 });
254254```
255255
@@ -261,7 +261,7 @@ fetch('/article/promise-chaining/user.json')
261261// 위 코드와 동일한 기능을 하지만, response.json()은 원격 서버에서 불러온 내용을 JSON으로 변경해줍니다.
262262fetch (' /article/promise-chaining/user.json' )
263263 .then (response => response .json ())
264- .then (user => alert (user .name )); // iliakan, got user name
264+ .then (user => alert (user .name )); // Violet-Bora-Lee, 이름만 성공적으로 가져옴
265265```
266266
267267불러온 사용자 정보를 가지고 무언가를 더 해보겠습니다.
@@ -317,7 +317,7 @@ fetch('/article/promise-chaining/user.json')
317317 }, 3000 );
318318 }))
319319 // 3초 후 동작함
320- .then (githubUser => alert (` Finished showing ${ githubUser .name } ` ));
320+ .then (githubUser => alert (` ${ githubUser .name } 의 이미지를 성공적으로 출력하였습니다. ` ));
321321```
322322
323323` (*) ` 로 표시한 곳의 ` .then ` 핸들러는 이제 ` setTimeout ` 안의 ` resolve(githubUser) ` 를 호출했을 때(` (**) ` ) 만 처리상태가 되는 ` new Promise ` 를 반환합니다. 체인의 다음 ` .then ` 은 이를 기다립니다.
Original file line number Diff line number Diff line change 11{
2- "name" : " iliakan " ,
2+ "name" : " Violet-Bora-Lee " ,
33 "isAdmin" : true
44}
You can’t perform that action at this time.
0 commit comments