Node.js · Junior · Question 39 of 75

What happens if a promise rejects and nothing handles the rejection?

Explanation

Since Node.js 15, unhandled rejections throw by default. Always await promises inside try/catch or add .catch().

Further reading

Problem with a question

Node.js · Junior · question 39

Test yourself

Take the Node.js · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz