Practice · 1 of 2
Await a Sequence
CHALLENGE
Difficulty: intermediate+25 XP
A fake API is provided: api.loadUser() returns a promise resolving to { name: "Ada" }, and api.loadGreeting(name) returns a promise resolving to "Hello, <name>".
1. Write an async function run() that awaits loadUser, then awaits loadGreeting with the user's name, and logs the final greeting.
2. Call run().
Press Submit to check your solution.
Back to lesson: Practice: Asynchronous JavaScript: Promises and async/await — Practice