Promisify setTimeout

Promisify setTimeout

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)'))

Published in dev.to · by sakethk · 1 min read · July 18, 2023