create a counter using settimeout in javascript 3f

Solutions on MaxInterview for create a counter using settimeout in javascript 3f by the best coders in the world

showing results for - "create a counter using settimeout in javascript 3f"
Alessandro
28 Sep 2017
1   //JAVASCRIPT
2   var count = 0;
3   function counter() {
4       document.getElementById("counter").innerHTML = count;
5       count = count + 1;      
6       setTimeout(counter, 1000) 
7   }
8   counter();
9
10   //HTML
11   Counter <span id="counter"> 0 </span> 
12 
13
14
similar questions