+ 13

Countdown timer

how to create a simplest countdown timer which counts from user inputted number to 0..I need a simplest method...

2nd Feb 2017, 3:29 PM
siddiq shameer
siddiq shameer - avatar
3 Answers
+ 11
setTimeout(callback,timemilliseconds);
2nd Feb 2017, 3:54 PM
Valen.H. ~
Valen.H. ~ - avatar
0
var time = 60; //this can be whatever you want setTimeout(function() { time--; }, 1000); // decrement after 1 second if (time <= 0) { done(); } function done() { //put the code that you want to handle the done call in here }
25th Mar 2017, 1:11 AM
Jacob Schneider
Jacob Schneider - avatar