functionclock() {// (3) Obtain "figure" class(image of the number)var figures =document.getElementsByClassName('figure');// (4) Obtain the "date" ID (Date display area)var date =document.getElementById('date');// (5) Obtain the current timevar now =newDate();// (6) Set the digits for the hours figures[0].src ='images/figure-'+tendigit(now.getHours()) +'.png'; figures[1].src ='images/figure-'+onedigit(now.getHours()) +'.png';// (7) Set the digits for the minutes figures[2].src ='images/figure-'+tendigit(now.getMinutes()) +'.png'; figures[3].src ='images/figure-'+onedigit(now.getMinutes()) +'.png';// (7) Set the digits for the seconds figures[4].src ='images/figure-'+tendigit(now.getSeconds()) +'.png'; figures[5].src ='images/figure-'+onedigit(now.getSeconds()) +'.png';// (8) Display the date date.textContent = renderDay(now.getDay()) + ", " + renderMonth(now.getMonth()) + " " + now.getDate() + ", " + now.getFullYear();
}