How can I enable the script?

The script calculates how much time you live (milliseconds, seconds, minutes, hours, days, weeks, months). It is necessary that the cycle was constant, for example, milliseconds should be considered from the date of birth and can run as a timer (without reloading browser). At the moment the script only executes 2 iterations and all. How to activate the timer?

https://codepen.io/aptyyyp/pen/YbMGZX
March 23rd 20 at 19:07
1 answer
March 23rd 20 at 19:09
Solution
use setInterval()
Works, but the conclusion of milliseconds occurs with each new line (because of br). And I wanted to specifically milliseconds worked as a timer and not on a new line)

Example:
5cf6f2ce966cc546484482.jpeg - anabelle.Kun commented on March 23rd 20 at 19:12
@anabelle.Kun, that prevents remove the br? but in such calculations it is better to use a web worker. it not slow down the page. - Elody commented on March 23rd 20 at 19:15
@anabelle.Kunto change the contents, not to add a new use instead
document.write , for example, innerHTML
- Nona.K commented on March 23rd 20 at 19:18
@Nona.K, Thank you, setInterval() working properly) - anabelle.Kun commented on March 23rd 20 at 19:21
@anabelle.Kun, not at all! - Nona.K commented on March 23rd 20 at 19:24

Find more questions by tags HTMLJavaScript