Published on January 26, 2024By DeveloperBreeze

function startCountdown(seconds) {
    let remainingTime = seconds;
    const countdownInterval = setInterval(() => {
        console.log('Time Remaining:', remainingTime, 'seconds');
        if (remainingTime === 0) {
            console.log('Countdown Complete!');
            clearInterval(countdownInterval);
        } else {
            remainingTime--;
        }
    }, 1000);
}
startCountdown(10);

Comments

Please log in to leave a comment.