분류 javascript

JavaScript 약속 : 9 가지 질문

컨텐츠 정보

  • 조회 78 (작성일 )

본문

https://danlevy.net/javascript-promises-quiz/ 


1. Multiple .catch’s 

var p = new Promise((resolve, reject) => {
  reject(Error('The Fails!'))
})
p.catch(error => console.log(error.message))
p.catch(error => console.log(error.message))

결과물은 무엇입니까?


2. Multiple .catch’s 

var p = new Promise((resolve, reject) => {
  return Promise.reject(Error('The Fails!'))
})
p.catch(error => console.log(error.message))
p.catch(error => console.log(error.message))

결과물은 무엇입니까?


3. Chaining .then and .catch’s 

var p = new Promise((resolve, reject) => {
    reject(Error('The Fails!'))
  })
  .catch(error => console.log(error))
  .then(error => console.log(error))

결과물은 무엇입니까?


4. Chaining .catch’s 

var p = new Promise((resolve, reject) => {
    reject(Error('The Fails!'))
  })
  .catch(error => console.log(error.message))
  .catch(error => console.log(error.message))

결과물은 무엇입니까?