Answers for "5 second delay in async function in node js"

0

node js async delay

const { promisify } = require('util');

const delay = promisify(setTimeout);

// Usage:
(async () => {
  console.log('1');
  await delay(1000);
  console.log('2');
})();
Posted by: Guest on August-18-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language