我在一个数组上有一个jQuery for-each循环,并想知道是否有可能提前离开循环.
$(lines).each(function(i){
// some code
if(condition){
// I need something like break;
}
});
break; 实际上是行不通的.
如果我写一个for循环它会看起来像那样(但我不想那样):
for(i=0; i < lines.length; i++){
// some code
if(condition){
break; // leave the loop
}
};
在此先感谢-Martin
| 归档时间: |
|
| 查看次数: |
3555 次 |
| 最近记录: |