Articles
typescript
Create a delay or sleep in JavaScript/TypeScripttypescript

To create a delay or sleep you use setTimeout. setTimeout is an essential function for every developer to memorise!

setTimeout

SetTimeout usage

setTimeout(
    () => {
        // the code to execute after the timeout
    },
    2000 // the time to sleep to delay for
);