当前位置:网站首页>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.
边栏推荐
- What is GameFi?
- MySql创建数据表
- 自定dialog 布局没有居中解决方案
- Artifact SSMwar exploded Error deploying artifact.See server log for details
- 2021美赛C题M奖思路
- quick-3.5 无法使用模拟器修改
- [swagger close] The production environment closes the swagger method
- Sqlite A列数据复制到B列
- On the side of Ali, tell me what are the application scenarios of message middleware you know?
- 360 hardening file path not exists.
猜你喜欢

为什么redis是单线程还那么快?

flutter arr 依赖

阿里云中mysql数据库被攻击了,最终数据找回来了

通信原理——纠错编码 | 汉明码(海明码)手算详解

Linux中mysql密码修改方法(亲测可用)

Chinese garbled solution in UTF-8 environment in Powershell

Artifact SSMwar exploded Error deploying artifact.See server log for details

【云原生】原来2020.0.X版本开始的OpenFeign底层不再使用Ribbon了

【windows】--- SQL Server 2008 超详细安装教程

Sqlite column A data is copied to column B
随机推荐
sqlmap injection tutorial common commands
Linux modify MySQL database password
feign调用不通问题,JSON parse error Illegal character ((CTRL-CHAR, code 31)) only regular white space (r
mysql常用命令
configure:error no SDL library found
Fragmented NFT (Fractional NFT)
js中流程控制语句
Sqlite column A data is copied to column B
How to distinguish big and small endian in C language
Gradle sync failed: Uninitialized object exists on backward branch 142
Common JVM interview questions and answers
quick-3.5 无法使用模拟器修改
为什么redis是单线程还那么快?
Why is the redis single-threaded also so fast?
Why does read in bash need to cooperate with while to read the contents of /dev/stdin
Getting to know regular expressions
Pure shell implementation of text replacement
MySQL-如何分库分表?一看就懂
configure:error no SDL library found
[Elastic-Job] Overview of Distributed Scheduling Tasks