// `sleep' function from @Clever Cheetah function sleep(delay) { let start = new Date().getTime(); while (new Date().getTime() < start + delay); } sleep(1000); console.log("Do something")