Skip to main content

Practice ยท 2 of 3

Sequential Dependency Chain

Write async function fetchProfile(db) where db provides getUser(id), getSettings(userId), and getFriends(userId) โ€” each returning promises. Fetch the user for id 7 first, then settings and friends IN PARALLEL using the user's id. RETURN { user, settings, friends }. If the user fetch fails, RETURN { error: "user-not-found" }.

Difficulty: intermediate

Back to lesson: Practice: Promises โ€” Practice