Returning a promise in new Promise() vs .then()
May 16, 2022
TL;DR: Returning a promise in `new Promise()` never resolves, but returning a promise in `.then()` does.
Consider the example below: The constructor of Promise expects a function that only resolves when its resolve() callback is called. Having it both (callbacks and return) could cause issues: To keep the API predictable, it was decided that the function yo...