当前位置:网站首页>There are many ways to realize the pause function in JS

There are many ways to realize the pause function in JS

2022-07-07 15:52:00 liangblog

JavaScript There's no sleep function , Only curve :

1、for loop :

function sleep(d){ 
    
  for(var t = Date.now();Date.now() - t <= d;);
}
sleep(1000); // Intrusion milliseconds , Such as 1 second , Pass on 1000

2、while Follow

原网站

版权声明
本文为[liangblog]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130609478674.html