bind bind var id=1001 var btn=document.querySelector("#btn") btn.onclick=function(){ setTimeout(function(){ console.log(this.id); }.bind(btn),3000) }