create a timer 60 second in javascript

index.tsx
// Set the countdown seconds
var countdownSeconds = 60;

// Set the timer interval
var countdownTimer = setInterval(function() {
  // If the countdown is over
  if(countdownSeconds == 0) {
    // Stop the timer
    clearInterval(countdownTimer);
    // Display the countdown is over
    console.log("Countdown is over!");
  } else {
    // Display the countdown seconds
    console.log(countdownSeconds);
    // Decrease the countdown seconds by 1
    countdownSeconds--;
  }
}, 1000); // Timer interval is 1 second (1000 milliseconds)
536 chars
19 lines

gistlibby LogSnag