How to create a fake JavaScript timeout in one line of code
July 24, 2024
Using the Promise() constructor, you can create a fake timeout in one line of code.
await new Promise((resolve) => setTimeout(resolve, 5000))
Change the 5000 value to set the time to wait in miliseconds.