What is the accuracy of timing such as setTimeout and setInterval? What is the minimum timing millisecond?

what is the accuracy of setTimeout and setInterval timing? What is the minimum timing millisecond? Is there anything you need to pay attention to?

Mar.04,2021

setTimeout and setInterval have no precision to speak of, they just throw the task into the event loop of js, and it may be their turn to execute.

setTimeout (() = > {xxx}, 0); will only be executed for you as soon as possible, but cannot be guaranteed to be executed immediately

.

refer to
" event loop "
actual delay ratio Reason for setting the value longer

if you only talk about the precision of parameters, millisecond
refer to API document

.

computer monitors are generally refreshed at 60Hz, redrawn 60 times per second.
therefore, if you want to achieve the smoothest animation, the best interval is 1000ms 16.6ms 60, which is about equal to the animation.

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-1b35c48-2b509.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-1b35c48-2b509.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?