js for in continue
时间: 2023-10-18 13:29:49 浏览: 137
javascript中for/in循环及使用技巧
在JavaScript中,for-in循环语句用于迭代对象的可枚举属性。然而,for-in循环无法保证返回对象属性的顺序。如果在for-in循环中使用continue语句来结束当前迭代,迭代语句仍然会继续执行。换句话说,使用continue语句只会跳过当前迭代的代码,而不会跳出整个循环。
请注意,for-in循环主要用于迭代对象的属性,而不是迭代数组中的元素。对于数组的迭代,可以使用for-of循环语句。for-of循环在迭代过程中可以使用break和continue语句来终止当前循环或跳过当前迭代。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [JS基础之选择循环结构--if、if..else、if...else...if...else、switch、while、、do...while、for、for-in/...](https://blog.csdn.net/weixin_43285360/article/details/115428900)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [浅谈JS for循环中使用break和continue的区别](https://download.csdn.net/download/weixin_38611527/14753674)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [js 循环for , for...in, for...of, forEach, map,some 中对 return, break, continue 的使用](https://blog.csdn.net/vhgvhbj/article/details/126506520)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文