Topics Covered

  • Duration: 80 minutes

  • Learning Objectives:

    • Master asynchronous programming concepts in JavaScript.

    • Learn about callbacks, promises, and async/await.

  • Outline:

    1. Introduction to asynchronous programming.

    2. Using callbacks for handling asynchronous tasks.

    3. Problems with callbacks (callback hell).

    4. Promises: structure, chaining, and error handling.

    5. Using async/await for cleaner asynchronous code​​.

  • Student Activity:

    • Implement a simple callback function for reading a file.

    • Convert the callback-based function into a promise-based function.

  • Homework Assignment:

    • Write a Node.js script using async/await to fetch data from a public API and log the results.

    • Identify and handle potential errors in your script.

Last updated