node js sleep seconds code example
Example 1: nodejs promise sleep
await new Promise(r => setTimeout(r, 2000));
Example 2: sleep in nodejs?
await sleep(1000)
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}