setInterval1 setTimeout/SetInterval setTimeout /일정 시간이 지난 후 함수 실행 setInterval /일정 시간 간격으로 함수 반복 function fn(){ console.log(3) } setTimeout(fn,3000); 3 => 이 코드와 같다 setTimeout(function(){ console.log(3) },3000); function showName(name) { console.log(name); } setTimeout(showName, 3000, 'Mike'); 함수 시간 인수 clearTimeout(tId); 예정된 작업을 없앨 때 쓴다. 스케줄링을 취소시킨다. 함수 앞에 붙인다. setInterval /일정 시간 간격으로 함수 반복 function showName(name) { console.log(name.. 2022. 2. 25. 이전 1 다음