Countdown, click event?

A timing examination system is triggered if the click event is triggered within 5 seconds, and if it is not triggered, the system marks the correct answer at the end of the countdown. How to implement

Feb.26,2021

setTimeout , setTimeout has a return value, first receive it with a variable, and then empty the variable according to the situation to mark whether 5 seconds have elapsed:

var timeout;
timeout = setTimeout(function() {
  console.log('Timeout exceeded');
  showAnswer();
  timeout = null;
}, 5000);

$('-sharpsomeID').click(function() {
  console.log('User clicked!');
  if(timeout) {
    // 5
    clearTimeout(timeout);  // 
    // Do something here
  } else {
    // 5
    // Do something here
  }
});
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bcb6f1-2f7c0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bcb6f1-2f7c0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?