3 ms·
No, just experience with a lot of codebases. Here's a simple question to ask yourself: what if non-IO operations allowed you to use the .then() syntax? If you
by nailer 6y ago
No, just experience with a lot of codebases.
Here's a simple question to ask yourself: what if non-IO operations allowed you to use the .then() syntax? If you have the choice to use:
1 + 1.then(function(result) { ... }
vs
const result = 1 + 1
Which would you choose?
- pavlov 6y agoUsing then() doesn't pause execution of the callsite function, while await does. Surely that's a relevant difference here? It doesn't seem unreasonable to use then() to express: "Run this anonymous function whenever the async thing completes. Meanwhile let's do this other stuff right now."
- nailer 6y agoBoth codebases can't do anything until `result` has a value.