Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Demystifying Async Programming in Javascript - fetchJson async await
async function () {
var user = await fetchJson('/api/user/self');
var interests = await fetchJson('/api/user/interests?userId=' +;
var recommendations = await Promise.all( => fetchJson('/api/recommendations?topic=' + i)));
render(user, interests, recommendations);

This comment has been minimized.

Copy link

richardkiss commented Mar 23, 2017

I think you want user instead of self in line 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.