当前位置:网站首页>es6的foreach与some的循环遍历
es6的foreach与some的循环遍历
2022-07-27 10:02:00 【骑上我心爱的小摩托】
1.foreach循环遍历
直接上代码:
result.value.forEach((item,index)=>{
console.log(index);
})
对于return,break不起作用
2.some的循环遍历
let arr = [1,2,3,4,5,6,7]
if (arr.some((item,index) => {
console.log(index);
if(item > 3){
//满足条件跳出
return true;
}
})) {
// return;
console.log("return之后的代码.");
}
console.log("之后的代码.");
打印出来的结果为:
1
2
3
return之后的代码.
之后的代码.
边栏推荐
- samba服务器
- Word2vec principle and application and article similarity (recommended system method)
- 01_ Movie recommendation (contentbased)_ Object portrait
- 女粉想要找男朋友,竟是为了...
- Shell operator, $((expression)) "or" $[expression], expr method, condition judgment, test condition, [condition], comparison between two integers, judgment according to file permission, judgment accor
- Introduction to Matlab real time editor
- Matlab-绘制叠加阶梯图和线图
- Anaconda安装(非常详细)
- 活体检测综述
- Shell read read console input, use of read
猜你喜欢

Food safety | the more you eat junk food, the more you want to eat it? Please keep this common food calorimeter

Xiandai 003

wind10配置adb命令

线代003

Basic statement of database operation

Review of in vivo detection

Girl fan wants to find a boyfriend, but it's for

超赞的卡尔曼滤波详解文章

There is no CUDA option in vs2019+cuda11.1 new project

Oracle查看硬解析
随机推荐
Live countdown 3 days sofachannel 29 P2P based file and image acceleration system Dragonfly
Dcgan paper improvements + simplified code
如何创建一个带诊断工具的.NET镜像
Anchor Free检测器:CenterNet
Hugo learning notes
Pygame: alien invasion
Mysql database experiment training 5, data query YGGL database query (detailed)
Matlab- draw superimposed ladder diagram and line diagram
RobotFramework+Eclispe环境安装篇
Des/3des/aes differences
Review of in vivo detection
window平台下本地连接远程服务器数据库(一)
Excellent Kalman filter detailed article
关于ETL的两种架构(ETL架构和ELT架构)
SE(Squeeze and Excitation)模块的理解以及代码实现
Leetcode.814. binary tree pruning____ DFS
声音处理之-梅尔频率倒谱系数(MFCC)
Based on LSM tree idea Net 6.0 C # write a kV database (case version)
Matlab-绘制日期和持续时间图
女粉想要找男朋友,竟是为了...