Webventures

To boldly go where countless others have gone before.

Returning a promise in new Promise() vs .then()

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...