8. Asynchronous Programming
Learning Objectives
By the end of this chapter, you will be able to:
- Describe the workings of an asynchronous operation
- Use callback to handle async operations
- Demonstrate callbacks and event loops
- Implement promises to handle async operations
- Rewrite async code with callbacks using promises
- Refactor your legacy code using async and await functions
In this chapter, we will explore the asynchronous (later abbreviated as async) nature of JavaScript. The focus will be on how conventional languages handle operations that take time to complete, and how JavaScript handles these operations. Later, we will discuss various methods we can adopt to handle these situations in JavaScript.