Minimum time granularity of timer problem

function getMini(){
  var i=0;
  var start=Date.now();
  var clock=setTimeout(function(){
      iPP;
      if(i==1000){
        clearTimeout(clock);
        var end=Date.now();
        console.log((end-start)/i);
      }
      clock=setTimeout(arguments.callee,0);
  },0);
  }
getMini();

although I often see and use the form of var timer=setTimeout () z, I don"t quite understand why timers have to be declared with a variable. Is it not clear about time without a variable declaration? clock=setTimeout (arguments.callee,0); what does this sentence mean, arguments? Callee points to the currently calling function, the anonymous function, but doesn"t the call function once again after all the internal js has been executed? Looking at the code means that clock has been executed 1000 times

Mar.03,2021

1. After the timer runs, it will return an id, that represents his unique identity, just like your ID number, the only function of this id for you is to use it to clear the timer, as you wrote in the following code

clearTimeout(clock)

2.setTimeout is an one-time timer, but in this example, a circular call is used. Each time the timer is executed, the next timer is rebuilt and customized until the timer is cancelled when I is 1000.

but are you sure your example will work? It is useless to cancel the timer first and set the timer. It has to be set up first and canceled according to the judgment condition.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3722e-2c082.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3722e-2c082.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?