当前位置:网站首页>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.
边栏推荐
猜你喜欢
随机推荐
Pure shell implementation of text replacement
浅谈对分布式模式下CAP的理解
Tencent Cloud Lightweight Server deletes all firewall rules
Understanding SSRF, this article is enough
js中的全局作用域与函数作用域
What is an EVM Compatible Chain?
sqlite 查看表结构 android.database.sqlite.SQLiteException: table splitTable has no column named
npm WARN config global `--global`, `--local` are deprecated. Use `--location解决方案
MySQL高级SQL语句(二)
Hyper-V新建虚拟机注意事项
Filter out egrep itself when using ps | egrep
sqlmap injection tutorial common commands
Xiaobai learns reptiles - introduction to reptiles
Several solutions for mysql startup error The server quit without updating PID file
Understanding of js arrays
腾讯云GPU桌面服务器驱动安装
Take you to understand the MySQL isolation level, what happens when two transactions operate on the same row of data at the same time?
MySQL错误-this is incompatible with sql_mode=only_full_group_by完美解决方案
Principle analysis of famous website msdn.itellyou.cn
quick-3.5 ActionTimeline的setLastFrameCallFunc调用会崩溃问题









