当前位置:网站首页>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.
边栏推荐
- quick-3.6源码修改纪录
- 一个简单的bash转powershell案例
- sqlite 查看表结构 android.database.sqlite.SQLiteException: table splitTable has no column named
- cocos create EditBox 输入文字被刘海屏遮挡修改
- Chinese garbled solution in UTF-8 environment in Powershell
- MySQL-如何分库分表?一看就懂
- powershell统计文件夹大小
- Common JVM interview questions and answers
- mysql password modification method in Linux (pro-test available)
- quick-3.5 ActionTimeline的setLastFrameCallFunc调用会崩溃问题
猜你喜欢

Powershell中UTF-8环境中文乱码解决办法

Flutter mixed development module dependencies

为什么bash中的read要配合while才能读取/dev/stdin的内容

动态规划(一)| 斐波那契数列和归递

Why is the redis single-threaded also so fast?

flutter 混合开发 module 依赖

Linux modify MySQL database password

js中的全局作用域与函数作用域

Fragmented NFT (Fractional NFT)

Using IIS10 to build an asp website in win11
随机推荐
Artifact SSMwar exploded Error deploying artifact.See server log for details
powershell统计文件夹大小
腾讯云GPU桌面服务器驱动安装
Regular Expression Basics
Tencent Cloud Lightweight Server deletes all firewall rules
[Cloud Native] What should I do if SQL (and stored procedures) run too slowly?
[Elastic-Job] Overview of Distributed Scheduling Tasks
mysql启动报错The server quit without updating PID file几种解决办法
cocos2d-x-3.2创建项目方法
Using IIS10 to build an asp website in win11
场效应管 | N-mos内部结构详解
js中的函数
[windows]--- SQL Server 2008 super detailed installation tutorial
【云原生】SQL(及存储过程)跑得太慢怎么办?
podspec 校验依赖出错问题 pod lib lint ,需要指定源
For penetration testing methods where the output point is a timestamp (take Oracle database as an example)
Notes on creating a new virtual machine in Hyper-V
【ubuntu20.04安装MySQL以及MySQL-workbench可视化工具】
The server time zone value ‘й‘ is unrecognized or represents more than one time zone
SSH自动重连脚本