SOURCE

console 命令行工具 X clear

                    
>
console
function throttle(fn,wait){
	con
  var timer;
	console.log(111)
  return function(...args){
		console.log(222)
    if(!timer){

      timer = setTimeout(()=>timer=null , wait);

      console.log(timer)

     
      return fn.apply(this,args)

    }  
 
  }

}



const fn = function(){

    console.log("btn clicked")

}

const btn = document.getElementById('btn');

btn.onclick = throttle(fn , 5000);
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>

  <button id="btn" style="margin-top:50px;color:red;">btn</button>
</body>
</html>