|
|
|
|
|
by mrozbarry
668 days ago
|
|
I prefer the raw promise syntax. It makes the promise chain look more like what it is, an asynchronous pipeline, and you don't need to litter async everywhere. const myAsyncThing = async (init) => {
let value = await task1(init);
value = await task2(value);
return value;
}
const myPromiseThing = (init) => task1(init).then(task2)
I know this is a relatively simple and contrived example, but there are some times where async/await very much is bulky and gets in the way of just writing code. |
|
Compare with
Afterwards either try-catch await myPromise, or use myPromise.then().catch()