Search⌘ K

Non-Promise Thenables

Explore how non-promise thenables work in JavaScript and understand how Promise.resolve and Promise.reject convert these objects into promises. Learn how this conversion supports backward compatibility and helps manage asynchronous code with confidence.

We'll cover the following...

Non-promise thenables

Both Promise.resolve() and Promise.reject() also accept non-promise thenables as arguments. When passed a non-promise thenable, these methods create a new promise that is called after the then() function. A non-promise thenable is created when an object has a then() method that accepts a resolve and a reject ...