JS递归
<script>var i=0;
window.onload=function(){
test();
}
function test(){
if(i==1){
console.log(1);
}else{
i++;
console.log(2);
this.test();
}
}
</script>
for循环隔几秒执行循环
<script>for(let i = 0; i < 5; i++){
setTimeout(()=>{
console.log(i);
}, 800 * i);
}
</script>
循环点击(避免重复点击)
for(var i=0;i<muiTableViewCell.length;i++){ (function(index) { muiTableViewCell[i].addEventListener('tap',function(){ if(!myapp_js.check_login()){ ca.prompt('请先登录'); return; } if(index == 1){ ca.newInterface({ url:'msg.html', id:'msg', styles:{ top:'0px', bottom:'', width:'', height:'' }, showType:'zoom-fade-out', showTime:200 }); } }); })(i); }
标签: js