Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It isn't, the following works fine...

    var data = await fetch(url).then(r => r.json());
Understanding Promises/A (thenables) and async/await can sometimes be difficult or confusing, especially when mixing the two like above.


Same thing. Maybe this doesn't make the double promise quite as visible, but it's still a double promise. You could probably replace the other await with a .then() too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: