Skip to content

[mjd] Day 39 - 45장: 프로미스 #36

Description

@mozzi34

김민서

문제 1

답 1

문제 2

답 2

김효인

문제 3

답 3

문제 4

답 4

박명준

문제 5

출력 순서 결과를 예상해서 적어주세요.

setTimeout(() => console.log(1), 0);

Promise.resolve()
  .then(() => console.log(2))
  .then(() => console.log(3));

답 5

문제 6

출력되는 결과로 올바른 것을 고르세요. (단, 해당 URL은 존재하지 않습니다.)

const wrongUrl = 'https://jsonplaceholder.typicode.com/XXX/1';

fetch(wrongUrl)
  .then(() => console.log('ok'))
  .catch(() => console.log('error'));
  1. 'ok'
  2. 'error'
  3. 아무것도 출력되지 않는다
  4. 에러 메시지가 출력된다

답 6

이율리

문제 7

다음 중 Promise.prototype.finally에 대한 설명으로 옳지 않은 것은?

A. finally는 then/catch와 달리, 반환값을 다음 체인에 전달하지 않는다.
B. finally 블록에서 던진 에러는 이후의 catch에 전달된다.
C. finally는 프로미스가 pending 상태일 때 즉시 실행된다.
D. finally 콜백이 실행된 뒤 원래의 성공/실패 값이 체인으로 전달된다.

답 7

문제 8

아래 코드를 실행했을 때 콘솔에 찍히는 순서와 값을 고르세요.

console.log('A');

Promise.resolve()
  .then(() => console.log('B'))
  .then(() => { throw new Error('E'); })
  .catch(() => console.log('C'))
  .finally(() => console.log('D'));

console.log('F');
  1. A → E → B → C → D

  2. A → B → F → C → D

  3. A → F → B → D → C

  4. A → F → B → C → D

답 8

임송이

문제 9

답 9

문제 10

답 10

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions