All challenges
Type an Async Data Fetch
mediumasync100 XPProblem
Define an interface ApiUser with id (number) and username (string). Write fetchUser(id: number): Promise<ApiUser> that simulates a network call by returning a resolved promise with a user whose username is "user_" followed by the id. Then write an async main that awaits the fetch and logs the username and the doubled id.
Expected output
user_7
14Hints
Stuck? Reveal hints one at a time.
Solution
Try solving it yourself first — revealing is always available.
Press Run in the editor — your console output is checked automatically.
No errors
Loading...
Console output appears here. Press Run or just type — the code compiles automatically.