function sleep(n) { var start = new Date().getTime(); while (true) { if (new Date().getTime() - start > n) { break; } } } console.log(11111111) sleep(2000); console.log(22222222)
function sleep(n) { var start = new Date().getTime(); while (true) { if (new Date().getTime() - start > n) { break; } } } console.log(11111111) sleep(2000); console.log(22222222)