Implement sleep

function sleep(ms = 0) {
  return new Promise(resolve => setTimeout(resolve, ms));
}
 
// one liner
 
const sleep = (ms = 0) => new Promise(resolve => setTimeout(resolve, ms));
Last Update: 19:38 - 18 April 2024

On this page

No Headings