+ 3
Timer Code Problem
4 Respostas
+ 5
The variables that shared between functions or class must be declared in global. Not only set timer to global, other variables also needed to be global.
var t, timer, hrs, min, sec;
And your timer object declared in the wrong place which making the object reset whenever the timer runs.
And also input.value is a string, you need to convert it to number before perform logical comparison.
Check out this code
https://code.sololearn.com/WOmHushIRy7k/?ref=app
+ 2
Make timer a global variable at the top of your code
+ 2
Roman Pervutinskiy what is the problem?
+ 1
When I press "Start!", time is showing, but not updating.