当前位置:网站首页>ES6 Beginner to Mastery #13: Extension Methods for Arrays 2
ES6 Beginner to Mastery #13: Extension Methods for Arrays 2
2022-08-10 00:56:00 【Kay Xiaomo】
说明
ES6 从入门到精通系列(全23讲)学习笔记.
遍历器
entries(),keys(),values(), 返回一个遍历器,可以使用 for···of 循环进行遍历
keys():The values traversalvalues():对键值对遍历entries():对键名遍历
console.log(["k", "a", "i", "m", "o"].keys());
console.log(["k", "a", "i", "m", "o"].values());
console.log(["k", "a", "i", "m", "o"].entries());

for (let key of ["k", "a", "i", "m", "o"].keys()) {
console.log(key);
}
for (let value of ["k", "a", "i", "m", "o"].values()) {
console.log(value);
}
for (let [key, value] of ["k", "a", "i", "m", "o"].entries()) {
console.log(key, value);
}

let kaimo = ["k", "a", "i", "m", "o"].entries();
console.log(kaimo.next().value)
console.log(kaimo.next().value)
console.log(kaimo.next().value)
console.log(kaimo.next().value)
console.log(kaimo.next().value)
console.log(kaimo.next().value)

includes
includes() 返回一个布尔值,表示某个数组是否包含给定的值
console.log([1,2,3].indexOf(1) > -1)
console.log([1,2,3].includes(1))

边栏推荐
- 【JZOF】82二叉树中和为某一值的路径(一)
- 【哲理】事教人
- Golden Warehouse Database KingbaseGIS User Manual (6.6. Geometric Object Verification Function, 6.7. Spatial Reference System Function)
- conda新建环境时报错NotWritableError: The current user does not have write permissions
- What are the Shenzhen fortress machine manufacturers?Which one do you recommend?
- Cmake 用法记录
- Mysql/stonedb - slow SQL - 2022-08-09 Q16 analysis
- harbor配置远程仓库
- 你的手机曾经被监控过吗?
- 2022年最新《谷粒学院开发教程》:10 - 前台支付模块
猜你喜欢
随机推荐
2022-08-09 mysql/stonedb-子查询性能提升-概论
【JZOF】32从上往下打印二叉树
什么是平面文件数据库? 如何导入多种格式的文件:DSV、JSON、XML?
Sqlserver restricts the ip under which accounts can access the database
Force Buckle: 474. Ones and zeros
What are the Shenzhen fortress machine manufacturers?Which one do you recommend?
ES6 从入门到精通 # 12:数组的扩展方法一
Comprehensive analysis of FPGA basics
阿里云短信服务开通
新开窗口 展示协议
Filament-Material 绘制基本图形
AppUser object extension based on ABP
2020年度SaaS TOP100企业名单
Mysql/stonedb - slow SQL - 2022-08-09 Q16 analysis
金仓数据库 KingbaseGIS 使用手册(6.4. 几何对象存取函数)
Filament - Material basic graphics drawing
Gumbel distribution of discrete choice model
直播预告 | ICML 2022 11位一作学者在线分享神经网络,图学习等前沿研究
《GB5084-2021》PDF下载
直播app开发搭建,flutter 实现自适应、自动换行、相对布局









