Romanovich095

Untitled

Sep 14th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const timeSpan = document.getElementById('time-span');
  2. const time = new Date();
  3.  
  4. function wrapTime(timePart) {
  5.   return timePart < 10 ? `0${timePart}` : timePart;
  6. }
  7.  
  8. setTimeout(function () {
  9.     timeSpan.textContent = `${wrapTime(time.getHours())}:${wrapTime(time.getMinutes())}:${wrapTime(time.getSeconds())}`;
  10. }, 1000);
Advertisement
Add Comment
Please, Sign In to add comment