Compared to the .then() style, this approach:
- Looks almost identical to the non-Promise version--you end up with imperative code, just like the non-Promise equivalent, instead of long
.then()chains. (Unfortunately you do still need to use.catch()to handle exceptions/rejections.) - Supports functions of multiple arguments, including functions where some of the arguments are Promises, and some not.
- Works by transforming a normal-looking function--if you have a pure function that is not asynchronous, with primitive types as arguments and a primitive type as a return value, you don't even need to know that Promises are involved.
- With a helper function, it also supports fairly natural-looking method calls where the arguments and return values are also Promises. (Though admittedly this does get a bit ugly...)