Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let hodiny = document.querySelector("#hodiny");
- let pocetVterin = 0;
- let pocetMinut = 0;
- let vteriny, minuty;
- const stopky = setInterval(function() {
- pocetVterin++;
- if (pocetVterin === 60) {
- pocetMinut++;
- pocetVterin = 0;
- }
- if (pocetVterin < 10) {
- vteriny = `0${pocetVterin}`;
- } else {
- vteriny = `${pocetVterin}`;
- }
- if (pocetMinut < 10) {
- minuty = `0${pocetMinut}`;
- } else {
- minuty = `${pocetMinut}`;
- }
- hodiny.textContent = `${minuty}:${vteriny}`;
- }, 1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement