1

if i use the setTimeout() function in Javascript, the script dont wait the exact time to trigger the code.

here is an example:

setTimeout(function(){ alert(''); }, 15000);

Sometimes the alertbox get executed after 13-14 seconds, and sometimes after 16-17 seconds.

why is it so and what can you do about it?

T0t4lW4yn3
  • 11
  • 1
  • 3
  • duplicate https://stackoverflow.com/questions/21097421/what-is-the-reason-javascript-settimeout-is-so-inaccurate – sheplu Oct 22 '17 at 22:01
  • That seems like a very large and unusual offset. Are you sure of your measurements? – jcaron Oct 22 '17 at 22:52

0 Answers0