当前位置:网站首页>关于for...in和for...of和Obeject.keys()的区别
关于for...in和for...of和Obeject.keys()的区别
2022-07-20 13:27:00 【潘潘同学】
//for in 遍历数组 得到的是下标 但是不建议用for in遍历数组,因为还会遍历开发者对数组对象自定义的可枚举属性及其原型链上的可枚举属性
//for in 遍历对象得到的是key 还会遍历原型链上可枚举的属性;
//for of 遍历数组的到的是value
// for of 不能遍历对象 如果想遍历对象的话需要配合Obeject.keys() 但是可以遍历类数组对象 map set集合
可搭配实例方法 entries(),同时输出数组的内容和索引;
暂时先写这么多,明天又面试,改天在整理加代码
边栏推荐
- 7天交付沈阳方舱医院项目,这就是鸿雁速度
- 网易游戏 Flink SQL 平台化实践
- How to implement JS template compilation
- Download address of canoe, download and activation of can demo 16, and appendix of all canoe software versions
- Navicat出现Rsa Public Key not Find问题如何解决
- 2.rsync
- 这款IDE插件3.0让你成为公司最懂安全的程序员
- 【微信小程序】slider滑动选择器(82/100)
- 抖音爱奇艺宣布合作,长短视频握手和解?
- APP自动化测试-4. App控件交互
猜你喜欢
Looking back from the eight queens problem (violent enumeration)
Clip based pornographic image recognition; The latest ml course collection of tubing; Write shell pipes interactively; Incremental perception data set of robot warehouse environment; Latest AI paper |
How to solve the RSA public key not find problem in Navicat
排序与检索(归并/快排/二分)
Netease game Flink SQL platform practice
[upload range 17-21] secondary rendering, conditional competition, black and white list bypass
Google 为造芯再掀“抢人大战”,英特尔 17 年老将加入
芯片卖到沙子价:雷军的梦想,让这家公司「糟蹋了」
行业现状令人失望,工作之后我又回到UC伯克利读博了
The replay block of canoe still needs to be combined with CAPL script to make it clear
随机推荐
How many months did you write your first SCI?
3D point cloud course (V) - in depth learning
Fabric.js 居中元素
软件测试技术之可用性测试之WhatsApp Web
二.uni-app页面基础[新建文件规范、页面生命周期]
Sorting and retrieval (merging / quick sorting / bisection)
推荐5款数据可视化强势工具
Mysql 系列 | 日志模块
Control the operation of the test module through the panel in canoe (Advanced)
Control the operation of the test module through the panel in canoe (primary)
业务出海,灵感乍现前要先「把手弄脏」
An application example of backtracking method -- prime number ring problem
Redis - CLUSTER命令中集群管理命令详解
三维点云课程(五)——深度学习
APP自动化测试-3. Appium元素定位与等待
FreeRTOS personal notes freertosconfig h
Automation sequences of canoe simulation functions
分布式事务
The electricity load of many provinces has reached a record high, and efforts have been made to ensure the safety of energy supply in summer
探究路径寻找问题BFS结点的判重方法