JSFiddle - React, Tailwind, and code Playground
JavaScript
var timeout = null;
function updateTimeout() {
timeout = setTimeout(updateTimeout, 1000)
console.log('hello')
}
// Start the timeout
updateTimeout();
// Your console should only log 'hello' twice
setTimeout(function() {
clearTimeout(timeout)
}, 2000)