Time is not running
I realise this
https://codepen.io/alpha_66/pen/JjzNdqx?editors=0010
the problem I have now is the time is not going (sorry for my english I m french guy)
can I get a idea about what is going wrong ?
thanks
5 Replies
It is because you set the time only once. you need some sort of method to do it every second, for example with an interval function
in your case, something like this
ref: https://developer.mozilla.org/en-US/docs/Web/API/setInterval
and if you want to clean up your code a bit
https://codepen.io/MarkBoots/pen/oNVWZEe
side note, if u do call setInterval or setTimeout it's a good practice to also clear it using clearInterval or clearTimeout, so the dedicated section of the browser for running these functions know that it no longer has to worry about those
thanks