Nice article.
Another clean "solution" I'd like to add is to use async/await:
constsummerActivities=async()=>{try{constresult=awaitfightTheDemogorgon();constseasonsLeft=awaitrollForDamage(result);constfinalResult=awaitcloseTheGateIn(seasonsLeft);console.log('Hawkins is safe for '+finalResult+' more seasons.'));}catch(e){failureCallback();}}
Nice article.
Another clean "solution" I'd like to add is to use
async/await
:This ^
And' it supported by major browser now. :D
caniuse.com/#feat=async-functions
The poly-fills for async/await can cost a lot of kb depending on how it's transpiled and chunked.
So keep that in mind if speed and legacy is a factor.
Thanks for the addition! 😎