let arr=[1,23,4,5,6,7,21,0]; function between(a,b){ return function(v){ return v>=a && v<=b; } } console.log(arr.filter(between(0,9)));
<button>后盾人</button> <button>后盾人1</button> </body> <style> button{ position:absolute; } </style> let bind=false; let btns=document.querySelectorAll("button"); btns.forEach(function(item){ item.addEventListener("click",function(){ if(!bind){ let left=1; // bind =true; bind= setInterval(function(){ item.style.left=(left++) + "px"; },100); } }) });