Sleep with Promise

const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
 
async function sleepyWork() {
  console.log('I am going to sleep for 5 seconds');
  await sleep(5000);
  console.log('I woke up after 5 seconds');
}
 
sleepyWork();
// I am going to sleep for 5 seconds
// ...waits 5 seconds
// I woke up after 5 seconds