当前位置:网站首页>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
边栏推荐
- LeetCode 879. 盈利计划
- MVFuseNet:Improving End-to-End Object Detection and Motion Forecasting through Multi-View Fusion of
- ERROR 1045 (28000) Access denied for user ‘root‘@‘localhost‘解决方法
- Summary of OCR optical character recognition methods
- Personal blog system (with source code)
- 实现改变一段文字的部分颜色效果
- 数组的子集不能累加出的最小正数
- gin 中间件
- [redis] redis development specifications and precautions
- 建木持续集成平台v2.5.2发布
猜你喜欢

Kubernetes (五) ---------部署 Kubernetes Dashboard

Flink实时仓库-DWD层(交易域-加购维度退化处理)模板代码

外包干了3年,跳槽后转自动化测试工资是原来的2倍,秘诀原来是......

Implementation of book borrowing management system based on C language

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

OCR光学字符识别方法汇总

ERROR 1045 (28000) Access denied for user ‘root‘@‘localhost‘解决方法

MySQL - multi table query

MySQL----多表查询

后缀自动机(SAM)讲解 + Luogu p3804【模板】后缀自动机 (SAM)
随机推荐
实现改变一段文字的部分颜色效果
Sword finger offer II 115: reconstruction sequence
最新百亿量化私募名单
我的创业邻居们
Flink实时仓库-DWD层(流量域)模板代码
Unity sends a post request to the golang server for parsing and returning
MVFuseNet:Improving End-to-End Object Detection and Motion Forecasting through Multi-View Fusion of
npm install 时,卡住不动,五种解决方法
Excerpts from good essays
Vite3.0 has been released, can you still roll it (list of new features)
Cvpr2022oral special series (I): low light enhancement
接口测试实战项目03:执行测试用例
图像加噪声与矩阵求逆
dba
Leetcode 879. profit plan
buck电路boot和ph引脚实测
vagrant box 集群 处理
Guess the number / / generate a random number for the first time
VMware16创建虚拟机:Win11无法安装
Unity发送Post请求给GoLang服务端解析并返回