Milad
BlogTagsProjectsOpen-Source ProjectsBooksCoursesAbout
Blog
Tags
Projects
Open-Source Projects
Books
Courses
About
Published on
Saturday, June 12, 2021 | ☕️ 1 min read

Sleep function

Authors
  • avatar
    Name
    Milad E. Fahmy
    Twitter
    @miladezzat12

Sleep function

when you need to delay some code async await before running.

const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

// await sleep(200); // 200 millisecond
Discuss on Twitter • View on GitHub

Tags

JavaScript

Previous Article

Create uuid (unique id)

Next Article

How to install typescript on Ubuntu
← Back to the blog
mailgithubfacebookyoutubelinkedintwitter
Milad Ezzat
•
© 2024
•
Milad Ezzat