VideosMy ProjectsProgramming BlogGallery
  1. Home
  2. Blog
  3. Create a delay or sleep in JavaScript/TypeScript
Programming Blog

Atom/RSS Feed

typescript

Create a delay or sleep in JavaScript/TypeScript

typescript

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
);
Join my mailing list