<p id="clock"></p>
subbed = new Date();
hour = subbed.getHours().toString().length < 2 ? '0' + subbed.getHours() : subbed.getHours();
min = subbed.getMinutes().toString().length < 2 ? '0' + subbed.getMinutes() : subbed.getMinutes();
sec = subbed.getSeconds().toString().length < 2 ? '0' + subbed.getSeconds() : subbed.getSeconds();
correct_date = `${hour}:${min}`;
// correct_date = `${hour}:${min}:${sec}`;
let clock = document.getElementById('clock')
setInterval(clock.innerHTML = correct_date, 1000);
correct_date = `${hour}:${min}`;
// correct_date = `${hour}:${min}:${sec}`;
const getTimeString = () => {
const subbed = new Date();
const hour = subbed.getHours().toString().padStart(2, '0');
cosnt min = subbed.getMinutes().toString().padStart(2, '0');
const sec = subbed.getSeconds().toString().padStart(2, '0');
return `${hour}:${min}:${sec}`;
}
let clock = document.getElementById('clock')
setInterval(() => {
clock.innerHTML = getTimeString();
}, 1000);