##原理 执行死循环,阻塞后续程序的执行,进而实现休眠的假象。 ```Javascript function sleep(delay) { var start = (new Date()).getTime(); while ((new Date()).getTime() - start < delay) { // 使用 continue 实现; continue; } } // 调用方法,同步执行,阻塞后续程序的执行; sleep(5000); ``` Last modification:November 11, 2021 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 0 If you think my article is useful to you, please feel free to appreciate
One comment
?议论文评语?