Break Asyncawait
π¨βπΌ Excellent! You've mastered async/await syntax.
You learned:
- β‘ Async functions return Promises automatically
- βΈοΈ Await pauses execution until Promise resolves
- π‘οΈ Try/catch handles errors naturally
- π Sequential flow reads like synchronous code
- π§ Return types document async function contracts
π¦ Remember: You can only use
await inside async functions. If you're at
the top level, wrap your code in an async function or use .then().// Top-level await (ES2022+)
const user = await fetchUser()
// Or wrap in async function
async function main() {
const user = await fetchUser()
}
main()
Next up: Modules!
Test Your Knowledge
Retrieval practice helps solidify learning by actively recalling information. Use this prompt with your AI assistant to quiz yourself on what you've learned.
Please quiz me on exercise 2 using the epicshop MCP server. Call the get_quiz_instructions tool with exerciseNumber "2" to get the quiz instructions, then quiz me one question at a time.