Courses / JavaScript
38. Promise.prototype.then()
Adding fulfillment and rejection handlers to a promise, and returning a new promise.
1 min read Chapter 38 of 99
JavaScript
Promise.prototype.then()
`then()` allows you to handle the result of a promise once it is fulfilled or rejected.
"I want to perform an action when my asynchronous code finishes, without blocking the main thread."
`then()` is a method that adds handlers for promise fulfillment and rejection, returning a new promise that resolves to the return value of the called handler.
"I want to perform an action when my asynchronous code finishes, without blocking the main thread."
`then()` is a method that adds handlers for promise fulfillment and rejection, returning a new promise that resolves to the return value of the called handler.