当前位置:网站首页>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之后的代码.
之后的代码.
边栏推荐
- 01_ Movie recommendation (contentbased)_ Object portrait
- Shell中的文本处理工具、cut [选项参数] filename 说明:默认分隔符是制表符、awk [选项参数] ‘/pattern1/{action1}filename 、awk 的内置变量
- Oracle查看硬解析
- 3D修复论文:Shape Inpainting using 3D Generative Adversarial Network and Recurrent Convolutional Networks
- Anchor Free检测器:CenterNet
- 声音处理之-梅尔频率倒谱系数(MFCC)
- Cannot start after installing MySQL 5.7.27 in CentOS 7? (Language bash)
- Snowflake vs. databricks who is better? The latest war report in 2022
- How to create a.Net image with diagnostic tools
- Basic statement of database operation
猜你喜欢

VS2019+CUDA11.1新建项目里没有CUDA选项

window平台下本地连接远程服务器数据库(一)

Local connection to remote server database under Windows platform (I)

Gbase 8A MPP cluster capacity expansion practice

Practice and exploration of overseas site Seata of ant group

SE(Squeeze and Excitation)模块的理解以及代码实现

Ant advanced task

Excellent Kalman filter detailed article

数据库性能系列之子查询

There is no CUDA option in vs2019+cuda11.1 new project
随机推荐
Understanding and code implementation of Se (sequence and exception) module
Shell运算符、$((运算式))” 或 “$[运算式]、expr方法、条件判断、test condition、[ condition ]、两个整数之间比较、按照文件权限进行判断、按照文件类型进行判断
线代004
Cannot start after installing MySQL 5.7.27 in CentOS 7? (Language bash)
NFT system development - Tutorial
Program translation and execution, from editing, preprocessing, compilation, assembly, linking to execution
Anaconda installation (very detailed)
Shell函数、系统函数、basename [string / pathname] [suffix] 可以理解为取路径里的文件名称 、dirname 文件绝对路径、自定义函数
【英雄哥六月集训】第 23天: 字典树
mount. Nfs: access denied by server while mounting
Word2vec principle and application and article similarity (recommended system method)
Introduction to Matlab real time editor
Ant advanced task
StyleGAN论文笔记+修改代码尝试3D点云生成
window平台下本地连接远程服务器数据库(一)
Understanding of batchnorm2d() function in pytorch
Excellent Kalman filter detailed article
【英雄哥六月集训】第 25天: 树状数组
Switch port mirroring Configuration Guide
Shell的read 读取控制台输入、read的使用