当前位置:网站首页>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
边栏推荐
- Flink real time warehouse DWD layer (traffic domain) template code
- Flink real-time warehouse DWD layer (processing complex data - installation and replacement of streams and tables) template code
- Kubernetes (V) -- deploy kubernetes dashboard
- Simulation volume leetcode [normal] 081. Search rotation sort array II
- 谷歌零碎笔记之JWT(草稿)
- mysql查询区分大小写
- NPM install reports an error NPM err could not resolve dependency NPM err peer
- 以太网接口介绍
- Simulation volume leetcode [normal] 222. number of nodes of complete binary tree
- Flink实时仓库-DWD层(处理复杂数据-流和表的装换处理)模板代码
猜你喜欢
随机推荐
Unity发送Post请求给GoLang服务端解析并返回
MySQL 有这一篇就够(呕心狂敲37k字,只为博君一点赞!!!)
Flink实时仓库-DWD层(流量域)模板代码
微服务远程调用
Can MySQL export tables regularly?
约瑟夫环问题
Custom events
Excerpts from good essays
VMware16安装虚拟机遇到的问题
Simulation volume leetcode [general] 150. evaluation of inverse Polish expression
fillder使用
Improved Pillar with Fine-grained Feature for 3D Object Detection论文笔记
1172. 餐盘栈 有序列表+栈
Why does ETL often become ELT or even let?
[C language brush leetcode] 1054. Bar code with equal distance (m)
【C语言刷LeetCode】1054. 距离相等的条形码(M)
最新百亿量化私募名单
上采样之反卷积操作
Leetcode-1331: array ordinal conversion
Implementation of DDP cluster distributed training under pytoch multi GPU conditions (brief introduction - from scratch)