67. create your own Promise
Share
medium - accepted / - tried
Promise is widely used nowadays, hard to think how we handled Callback Hell in the old times.
Can you implement a MyPromise Class by yourself?
At least it should match following requirements
- new promise:
new MyPromise((resolve, reject) => {}) - chaining :
MyPromise.prototype.then()then handlers should be called asynchronously - rejection handler:
MyPromise.prototype.catch() - static methods:
MyPromise.resolve(),MyPromise.reject().
This is a challenging problem. Recommend you read about Promise thoroughly first.
Related Lists
Promise / Async functions