当前位置:网站首页>js中break与continue和return关键字
js中break与continue和return关键字
2022-07-29 06:40:00 【河北不知名小趴菜】
break停止循环,后续不进行
continue停止当前循环,继续后面的循环;
<script>
for(var i=0;i<5;i++){
if(i==3){
break;
}
console.log(i);
}
for (var i=0;i<5;i++){
if(i==3){
continue;
}
console.log(i);
}
</script>
return让函数停止执行,只能用于函数内
function fn(){
console.log('zhang');
return;
console.log('xiaogou');
}为什么要用函数返回值:方便函数复用
函数执行完成后都有返回值
不使用return默认返回值是undefined
函数中return的实际应用
封装$()函数
封装getStyle()函数
currentStyle/getComputedStyle--arguments
边栏推荐
- IO stream - file - properties
- 基于C语言设计的学生成绩排名系统
- gin 服务退出
- Kubernetes (五) ---------部署 Kubernetes Dashboard
- Overview of database system
- Homebrew brew update 长时间没反应(或卡在 Updating Homebrew...)
- After three years of outsourcing, the salary of automatic testing after job hopping is twice that of the original. The secret is
- VMware16安装虚拟机遇到的问题
- Vite3.0都发布了,你还能卷得动吗(新特性一览)
- npm install 时,卡住不动,五种解决方法
猜你喜欢

Operator3-设计一个operator

After three years of outsourcing, the salary of automatic testing after job hopping is twice that of the original. The secret is

怎么会不喜欢呢,CICD中轻松发送邮件

Kubernetes (V) -- deploy kubernetes dashboard

数组的子集不能累加出的最小正数

Revolution of game assets

Vmware16 create virtual machine: win11 cannot be installed

VMware16创建虚拟机:Win11无法安装

最新百亿量化私募名单

Unity free element special effect recommendation
随机推荐
MySQL queries are case sensitive
Flink real time warehouse DWD layer (traffic domain) template code
pytest合集(7)— 参数化
SQL优化
Vmware16 create virtual machine: cannot create a new virtual machine, do not have permission to perform this operation
Relative date used by filter in salesforce
Unity free element special effect recommendation
VMware16创建虚拟机:Win11无法安装
2022-07-28:以下go语言代码输出什么?A:AA;B:AB;C:BA;D:BB。 package main import ( “fmt“ ) func main() { f
我的个人网站不让接入微信登录,于是我做了这个
Sword finger offer II 115: reconstruction sequence
[CF1054H] Epic Convolution——数论,卷积,任意模数NTT
Simulation volume leetcode [ordinary] 172. Zero after factorial
gin 中间件
【C语言刷LeetCode】1054. 距离相等的条形码(M)
OCR光学字符识别方法汇总
Redis基础篇
Unity发送Post请求给GoLang服务端解析并返回
MySQL----多表查询
Unity sends a post request to the golang server for parsing and returning