Javascript/Node 'sleep' function

PHOTO EMBED

Mon Mar 29 2021 17:30:16 GMT+0000 (UTC)

Saved by @daronimo #javascript #node #sleep

function timeout(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

await timeout(1000); // pauses execution for 1000ms
content_copyCOPY