Promisify setTimeout
sakethk
Posted on October 9, 2021
Code to promisify setTimeout
const delay = (time) => new Promise((resolve, reject) => setTimeout(resolve, time))
Usage
delay(2000).then(() => console.log('Hello i will get logged after 2 second(s)'))
💖 💪 🙅 🚩
sakethk
Posted on October 9, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
javascript JavaScript Meta Programming: In-Depth Guide on Proxy, Reflect, and Object Property Control
November 6, 2024