Simplified version of handwritten promise ideas

Constructorconstructor(executor) resolveand rejectfunction then(onFulfilled, onRejected) Chained calls and asynchronous execution Error handling catch(onRejected) This SimplePromiseclass implements thenand catch, but does not implement Promiseall the functions of , such as Promise.all, Promise.race, Promise.resolve, Promise.rejectand other…