Synchronous vs Asynchronous Code
AI Using GitHub Copilot in VS Code
<aside> 🚧
This page is currently under construction. Please check back later.
</aside>
setInterval()In this exercise you will create a traffic light that repeatedly cycles through its three states: GO, WAIT, and STOP. After four full cycles, the simulation should stop.

npm project with a proper package.json.chalk dependency..gitignore and add node_modules/..prettierrc file.src subfolder.traffic-light-1.js inside the src folder and paste in the content of the code block below.The provided code already includes an object that models a traffic light and a function that updates the model and writes its current state to the console.Your job is to implement the TODO in the body of the main() function, such that you obtain the same result as shown in the animation above.
setTimeout()In real traffic lights, the time for each state is not the same. GO is followed by a shorter WAIT and a longer STOP. In this exercise we will try and simulate a traffic light with different times for each state. It should look like this:

src folder, create a file traffic-light-2.js. Paste in the code from the block below, then replace the abbreviated parts with the full code from the previous exercise.main() function, such that you obtain the same result as shown in the animation above.async/awaitIn this exercise, you should obtain the same result as in exercise 2, but now using promises and async/await. This helps you escape from “callback hell” and greatly simplifies the code.
traffic-light-3.js in the src folder and paste in the code from the code block below. Replace the abbreviated code with the full code from the previous exercise.From the Learning-Resources repository, follow the instructions from the README in the link below to complete the fetch logic of the Deck Of Cards application:
https://github.com/HackYourFuture/Learning-Resources/tree/main/core-program/week-10/deck-of-cards

Found a mistake or have a suggestion? Let us know in the feedback form.