Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const timeSpan = document.getElementById('time-span');
- const time = new Date();
- function wrapTime(timePart) {
- return timePart < 10 ? `0${timePart}` : timePart;
- }
- setTimeout(function () {
- timeSpan.textContent = `${wrapTime(time.getHours())}:${wrapTime(time.getMinutes())}:${wrapTime(time.getSeconds())}`;
- }, 1000);
Advertisement
Add Comment
Please, Sign In to add comment