사용법

setInterval( fn, milisecond );

function PrintTime() {
    const today = new Date();
    const hh = today.getHours();
    const mi = today.getMinutes();
    const ss = today.getSeconds();
	
	// console.log(hh + ":" + mi + ":" + ss);
	console.log(`${hh}:${mi}:${ss}`);
}

// 중지를 위해 ID 보관
var timerId = null;

// 시계 시작
function StartClock() {
    PrintTime();
    timerId = setInterval(PrintTime, 1000);
}

// 시계 중지
function StopClock() {
    if(timerId != null) {
        clearInterval(timerId);
    }

}

StartClock();
//StopClock();