JS如何实现sleep

By | 2022-01-19

Sleep use JS

function sleep(delay) {
  var start = (new Date()).getTime();
  while ((new Date()).getTime() - start < delay) {
    continue;
  }
}