timer - JavaScript Backwards Countdown with 1 second pause -
can let me know i'm going going? i'm trying count down given number in code , print screen 1, pause 1 second, print 2, pause 1 second, print 3, pause 1 second...
i tried using sleep(1000)
'sleep undefined' error , when use below code settimeout(1000)
returns "invalid arguement"
var i; function timer() { (i = 0; <= 10; i++) { settimeout(1000); document.write(i); } } timer();
the settimeout doesn't work that, not same sleep in java or other language
you can use like
var = 0; function timer(){ document.write(i++); if(i >= 10){ clearinterval(timerid) } } var timerid = setinterval(timer, 1000)
Comments
Post a Comment