JSFiddle - React, Tailwind, and code Playground

HTML

<body>
  <p>Move your mouse in this document</p>
  <div id="demo"></div>
</body>

JavaScript

function throttle(func, delay=1500) {
  let timeout = null
  return function(...args) {
    if (!timeout) {
      timeout = setTimeout(() => {
        func.call(this, ...args)
        timeout = null
      }, delay)
    }
  }
}

document.body.addEventListener("mousemove", throttle(function(){
    document.getElementById("demo").innerHTML += "Hello World</br>";
},1000));