JSFiddle - React, Tailwind, and code Playground

by suhail

HTML

<div id="test">
  click
</div>

JavaScript

let timer;

function delay() {
	clearTimeout(timer);
  timer = setTimeout(function() {
    alrt();
  }, 1000);
}
$('#test').on('click', function() {
  delay();
});


function alrt() {
  console.log(new Date().getSeconds());
}