en.javascript.info/1-js/09-async/03-promise-chaining/02-error-async/task.md
2019-03-02 23:36:50 +03:00

223 B

Error in setTimeout

What do you think? Will the .catch trigger? Explain your answer.

new Promise(function(resolve, reject) {
  setTimeout(() => {
    throw new Error("Whoops!");
  }, 1000);
}).catch(alert);