当前位置:网站首页>break and continue exit in js
break and continue exit in js
2022-07-31 05:59:00 【messy me】
The break and continue statements provide more control over the code inside the loop.
The difference between break and continue statement:
Thebreak statement exits the loop immediately, preventing any code from being executed again and again.
While the continue statement just exits the current loop, it also allows to continue to the next loop according to the control expression.
break to exit:The break keyword can be used to exit a switch or loop statement. Break and continue cannot be used in an if statement.The break keyword will immediately stop the loop statement closest to it.continue to exit:The continue keyword can be used to skip the current loop, and continue also acts on the loop closest to it by default.The continue keyword will be used to skip the current loop.
breakout:
break to exit:for(var i=0; i<5; i++){console.log(i);if(i == 2){break;}}
The output result is 0;1;2.
continue to exit:
continue to exit:for(var i=0; i<5; i++){if(i==2){continue;}console.log(i);}
The output result is 0;1;3;4.
边栏推荐
猜你喜欢
计网 Packet Tracer仿真 | 简单易懂集线器和交换机对比(理论+仿真)
Gradle sync failed: Uninitialized object exists on backward branch 142
npm WARN config global `--global`, `--local` are deprecated. Use `--location solution
Principle analysis of famous website msdn.itellyou.cn
最新MySql安装教学,非常详细
npm WARN config global `--global`, `--local` are deprecated. Use `--location解决方案
UiBot存在已打开的MicrosoftEdge浏览器,无法执行安装
著名网站msdn.itellyou.cn原理分析
MySQL错误-this is incompatible with sql_mode=only_full_group_by完美解决方案
MySQL面试题大全(陆续更新)
随机推荐
sqlite 查看表结构 android.database.sqlite.SQLiteException: table splitTable has no column named
On the side of Ali, tell me what are the application scenarios of message middleware you know?
SQLite 查询表中每天插入的数量
一文速学-玩转MySQL获取时间、格式转换各类操作方法详解
The latest MySql installation teaching, very detailed
mysql启动报错The server quit without updating PID file几种解决办法
powershell statistics folder size
Sqlite A列数据复制到B列
Notes on creating a new virtual machine in Hyper-V
Attribute Changer的几种形态
Linux修改MySQL数据库密码
this指向问题
How to distinguish big and small endian in C language
[Elastic-Job] Overview of Distributed Scheduling Tasks
360 加固 file path not exists.
【swagger关闭】生产环境关闭swagger方法
Detailed explanation of pointers in C language
Flow control statement in js
"limit" query in Oracle database
quick lua加密