function digital() { let laHora = new Date(); let horas = laHora.getHours(); if (horas < 10) { horas = "0" + horas; } let minutos = laHora.getMinutes(); if (minutos < 10) { minutos = "0" + minutos; } let segundos = laHora.getSeconds(); if (segundos < 10) { segundos = "0" + segundos; } const reloj = `<aside id="relojillo"><h1>${horas} : </h1> <h2>${minutos}</h2><sup><h3> : ${segundos}</h3></sup></aside>`; const salida = document.getElementById("elReloj").innerHTML = reloj; setTimeout(digital, 1000); return salida; } digital();
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter