Dresdner Klimaaktivist

JavaScript-Timer-Test

Interval 1: Interval 2: Interval 3:

This page runs 3 timers:
1. with 30 ms interval
2. with 3 s interval
3. with 30 s interval

Here is the JavaScript source:
<script>
var a1 = 0; setInterval(function() { document.getElementById(1).innerHTML+=a1+"\n"; a1++; }, 30);
var a2 = 0; setInterval(function() { document.getElementById(2).innerHTML+=a1+'/'+a2+"\n"; a2++; a1=0; }, 3000);
var a3 = 0; setInterval(function() { document.getElementById(3).innerHTML+=a1+'/'+a2+'/'+a3+"\n"; a3++; a2=0}, 30*1000);
</script>


This page was created as an answer to the StackOverflow question “setTimeout is not working when Windows goes to sleep mode and then wake up”, before JSFiddle was known to me.