
Explore asynchronous JavaScript—from callbacks to promises, async/await, and generators—in a hands-on deep dive that includes exercises and complete code files to reinforce concepts.
Define synchronous and asynchronous code, compare their differences and trade-offs, and explain the event loop's role in enabling asynchronous JavaScript. Examine common patterns for writing asynchronous code.
Explore the difference between synchronous and asynchronous JavaScript, learn how blocking and non-blocking execution shape performance, and discover callbacks and setTimeout as core async patterns.
Compare synchronous and asynchronous coding in JavaScript, weighing ease of writing and blocking risks against performance gains, and use asynchronous patterns when it makes sense.
Explore how JavaScript achieves asynchronous code through callbacks, setTimeout, the event loop, and message queues, enabling single-threaded execution to handle timers and callbacks.
Explore the callback pattern as the foundational approach to asynchronous JavaScript, its role alongside promises and async/await, and the drawbacks that led to newer patterns.
Discover how callbacks drive asynchronous execution in javascript, using setTimeout and event listeners, and harness higher-order and anonymous functions.
Discover how to create and use callbacks in JavaScript, filter data by conditions, pass callbacks to reusable functions, and use closures to accumulate totals.
Learn how callbacks interact with the event loop to create asynchronous behavior, why a callback alone isn't enough, and how this applies to databases, API calls, and user input.
Analyze the code to make it synchronous using set time out, focusing on the determined total function, and explore callbacks and asynchronous code.
Explore common pitfalls with set time out in JavaScript, distinguishing asynchronous from synchronous code, fix incorrect callbacks, and emphasize using functions without invoking them, before moving to promises.
Explore the problems of callbacks in asynchronous JavaScript, including callback hell and inversion of control, and understand why promises were developed to address these issues.
Explore promises in detail and learn to use and create your own promises, addressing callback problems with an ES6 asynchronous pattern and practicing key promise methods.
Explore how promises in JavaScript model asynchronous operations as objects representing future completion, with values returned when resolved, and learn to use then, catch, and creating your own promises.
Learn to use promises in JavaScript with the then method to respond to resolution or error, and to chain promises for cleaner, asynchronous code, avoiding callback hell.
Explore how to fetch word data from an API using promises, chain then calls, parse JSON to get a word and its definition, and handle errors with catch.
Explore the fetch API as a simple way to perform HTTP requests, retrieve data with promises and response.json(), and consider browser compatibility.
Learn asynchronous data retrieval with fetch and promises by pulling a Star Wars character and its homeworld from the Star Wars API, using regular and arrow functions and console logging.
Explore fetching data with promises and json parsing by retrieving todos from a Jason Place holder site, logging results, and simulating post requests with error handling.
Explore how to fetch Star Wars film data with jQuery's getJSON, chain promises, iterate planets with forEach, and handle errors.
Practice retrieving a Scrabble score by querying the Wordnik API with a user-entered word, then display the score beside the input using a module pattern and a button click.
Fetch the Scrabble score for a given word using a constructed url, handle promises, parse json, and display the score in the browser using dom updates.
Practice downloading posts, comments, and todos from jsonplaceholder using an immediately invoked function expression, handling asynchronous code and assigning results to a main variable accessible by the app.
Explore parallel fetches that populate a shared object referenced by the main app. Understand mutability and how asynchronous updates reflect across the NSP object.
Learn how to create and return promises with the JavaScript promise constructor, use resolve and reject, and handle results via then and catch in asynchronous code.
Explore preventing blocking in a long-running massive process by applying set time out for non blocking execution, then convert to a promise to handle the result asynchronously.
Return a new promise that validates the input and rejects if not a number, then resolve with the results and handle with then and catch for asynchronous, non-blocking behavior.
The lecture explains why set time out and promises create asynchronous code. It compares their behavior on the event loop and describes microtask versus macrotask scheduling on a single thread.
Explore the finally method in promises, which fires after resolution or rejection to perform cleanup tasks, alongside then and catch in a promise chain.
Explore promise.all and promise.race, two static methods on the promise constructor. Use all to wait for all promises and return an array; race returns the first resolved value.
Apply Promise.all to coordinate three fetch requests for post comments and todos, then log a completion notification when all promises resolve.
Finish exercise by setting three promises for posts, comments, and todos, use Promise.all to fetch them in parallel, and map results to NSP variables.
Explore promise.allSettled and promise.any, comparing how allSettled waits for all promises to settle (fulfilled or rejected) while any resolves on the first fulfilled promise, with practical fetch examples.
Use an abort controller with fetch to abort a promise by passing the controller signal in fetch options and calling abort when needed.
Explore how async/await simplifies promise-based code by making it look synchronous without blocking the execution thread, while recognizing when to use promises versus async/await.
Learn how async functions return promises and how await pauses execution to resolve them. See how this works with both function declarations and expressions, and compare with then-based handling.
Apply the async/await pattern to fetch the Star Wars API films, extract movie titles with map into an array, and write cleaner asynchronous code without nested callbacks.
Create an async function that fetches posts for a given userId from jsonplaceholder using await, storing the results in an array and handling the returned promise.
Create an async function retrieve posts with a user id parameter, fetch and parse posts as json, filter by user id, and resolve the promise using then to assign results.
Refactor a jQuery promise example to async/await, using try-catch and a for of loop with await to fetch a Star Wars film and its planets from the Star Wars API.
Explore using throw to create exceptions in try catch, validating input with isNaN, and triggering catch to handle invalid movie numbers in async code.
Refactor the jsonplaceholder to-dos promise example with an immediately invoked function expression (iife) using async/await to fetch, await data.json, and log the results.
Refactor the promise-based code into an async function that adds a to-do to the Jason Place holder site by passing a to-do object, logs the results, and handles errors.
Define an async add todo function using fetch to post a JSON body, await and parse the response, and implement try/catch for errors.
Convert the promise code to async/await inside the module pattern’s IIFE, fetch posts from the placeholder site, and assign them to NSP in the main app for access.
Explore finishing exercise seven by setting up an async function, fetching data with await, parsing JSON, and handling errors with try-catch, then compare async/await to promises for readability in JavaScript.
Learn to use Promise.all with async/await to wait for multiple promises and assemble first, middle, and last names, then compare with Promise.race for the fastest resolution.
Refactor the json placeholder fetches for posts, comments, and todos from promises to async/await, using Promise.all to retrieve all three in parallel, then compare patterns.
Learn to build an async function with an immediately invoked function expression and try/catch to fetch posts, comments, and to dos. Compare async/await and promise patterns.
Learn careful coding with async/await to manage asynchronous code, keep async functions small, understand the event loop, macro vs micro tasks, and when promises may be a better choice.
Learn how to apply the async keyword to object methods, use await for asynchronous waits, and view examples with objects and prototype methods using set time out.
Explore generators, a pattern older than async/await, that lets code pause at yield and resume later. See how a generator can exit before finishing and be reentered, enabling non-blocking pauses.
Learn how to set up and use generators in JavaScript, declare generator functions with an asterisk, and pause with yield while using next to advance and inspect value and done.
Explore creating a Fibonacci generator in JavaScript by converting a while-loop function into a generator with an asterisk definition, yield, and next to iterate through numbers.
Implement a generator that acts as a producer of a random value, returning a number on each next call between 1 and the end passed in.
Learn to implement a generator that yields random numbers from 1 to a given end value using a loop and yield, with finite or infinite looping.
Explore how generators implement iterators, using next and yield to traverse arrays and infinite data streams, and learn how the done flag signals completion.
Explore how the iterator symbol enables for-of iteration across arrays, strings, and node lists via dot next, and how to define a custom object iterator with Symbol.iterator and a generator.
Explore two-way communication with generators by passing values into and out of a generator using next and yield. See a yield console example that logs input and shows value flow.
Congratulations on finishing the course. Apply the asynchronous coding patterns in your own code, practice with the introduced sites and APIs, and review exercises to strengthen your JavaScript skills.
Effectively working with asynchronous code in JavaScript is an essential skill for anyone working with JavaScript. Asynchronous patterns are used extensively. This course will take you from a beginner or intermediate level to mastering asynchronous JavaScript. You will feel comfortable dealing with any asynchronous code.
This course start with the basics of asynchronous coding in JavaScript. We take a look at the event loop and the role it plays in asynchronous JavaScript. We dig into the original asynchronous pattern, the callback. We dive into Promises, and tackle this subject in depth. We then add the async await pattern to the discussion. In the last section we cover generators and how and when they can be used in your code. Code example are used throughout the course and there are plenty of chances for you to try things on your own.
By taking this course you will be able to:
Explain the role of the Event Loop in asynchronous coding.
Use callbacks throughout your code.
Incorporate and work with promises no matter the source.
Use the async await pattern to make your asynchronous code easier to reason about.
Incorporate generators when needed.
This is one of the best courses produced on asynchronous JavaScript. It contains unmatched coverage. If you are looking to learn this very important topic, this course is for you.