当前位置:网站首页>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.
边栏推荐
- npm WARN config global `--global`, `--local` are deprecated. Use `--location solution
- 动态规划(一)| 斐波那契数列和归递
- What is an EVM Compatible Chain?
- npm WARN config global `--global`, `--local` are deprecated. Use `--location解决方案
- 阿里云中mysql数据库被攻击了,最终数据找回来了
- 微信小程序启动优化
- jenkins +miniprogram-ci 一键上传微信小程序
- mysql启动报错The server quit without updating PID file几种解决办法
- Digital twins will be an important way to enter the "metaverse"
- 【uiautomation】微信好友列表获取(存储到txt中)
猜你喜欢
UiBot has an open Microsoft Edge browser and cannot perform the installation
Using IIS10 to build an asp website in win11
【ubuntu20.04安装MySQL以及MySQL-workbench可视化工具】
js中的全局作用域与函数作用域
MySQL高级学习笔记
工件SSMwar exploded 部署工件时出错。请参阅服务器日志了解详细信息
MySQL错误-this is incompatible with sql_mode=only_full_group_by完美解决方案
Gradle sync failed: Uninitialized object exists on backward branch 142
【云原生】开源数据分析 SPL 轻松应对 T+0
[Cloud native] Simple introduction and use of microservice Nacos
随机推荐
DeFi Token in the project management
工件SSMwar exploded 部署工件时出错。请参阅服务器日志了解详细信息
Pure shell implementation of text replacement
Using IIS10 to build an asp website in win11
What is GameFi?
Yuan prospect and four track of the universe
(Crypto essential dry goods) Detailed analysis of the current NFT trading markets
[Cloud native] Open source data analysis SPL easily copes with T+0
Artifact SSMwar exploded Error deploying artifact.See server log for details
通信原理——纠错编码 | 汉明码(海明码)手算详解
npm WARN config global `--global`, `--local` are deprecated. Use `--location solution
纯shell实现文本替换
cocos2d-x-3.2 不能混合颜色修改
cocoscreator 显示刘海内容
What is an EVM Compatible Chain?
Why does read in bash need to cooperate with while to read the contents of /dev/stdin
quick-3.5 ActionTimeline的setLastFrameCallFunc调用会崩溃问题
For penetration testing methods where the output point is a timestamp (take Oracle database as an example)
【云原生】微服务Nacos的简单介绍与使用
Error: Cannot find module 'D:\Application\nodejs\node_modules\npm\bin\npm-cli.js'