Returns a rejected Promise object with a given reason.



The reason can be most data types, including:

  • numbers
  • strings
  • objects ( ones of type Error recommended for improved error-catching)


A new Promise, myPromise, is rejected with an Error message by default. Lastly, the error message, err.message, is logged to the console through the catch-block.

const myPromise = Promise.reject(new Error('Promise rejected'));
myPromise.catch((err) => {
console.log(err.message); // Output: Promise rejected


Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn JavaScript on Codecademy