当前位置:网站首页>js中对Array进行遍历
js中对Array进行遍历
2022-04-22 22:49:00 【lanxing_thk】
1 问题
- 记录一下使用for循环
- 主要是通过of 会更加简洁
2 方式一
let names = ['a','b','c'];
for(let item of names){
console.log(item);
}
3 方式二(传统)
let names = ['a','b','c'];
for(let i; i < names.length; i++){
console.log(names[i]);
}
4 心得
还有很多其它写法,但我觉得只要能够解决问题,就是好方法,没有必要刻意去简化,更多地去思考自己的问题
版权声明
本文为[lanxing_thk]所创,转载请带上原文链接,感谢
https://blog.csdn.net/lanxing_huangyao/article/details/124344680
边栏推荐
猜你喜欢

【Paper】2019_ Distributed fixed-time consensus-based formation tracking for multiple nonholonomic whee

API 网关实现功能

Online yaml to XML tool

Advanced multithreading (6) -- locking mechanism

RPC details

Clustering data generation function -- make_ blobs()

Redis部署

Regular expression of JS

Catering industry cashier system source code, C # Net + MSSQL WPF

News Express I mobtech passed the "special safety evaluation" of China Academy of information and communications
随机推荐
正则表达式——IP地址匹配
How does alicloud server hide real IP
Multithreading advanced (7) -- optimistic lock and pessimistic lock
2022-4-22作业-MySQL单表查询
CISSP认证每日知识点(2022年4月22日)
Steps to build appinventor2 on the window
In the future, platofarm's ecological pass can be logged into bitmart and other four major global platforms
Flutter 一文搞定图片选择和图片上传
MySQL表的增删改查(进阶)
聚类数据生成函数--make_blobs()
Study notes 2-0417
Cap theory
How to open MT5 account and what products can MT5 trade?
Go语言学习笔记——读锁重入导致死锁
邀请你参与字节跳动 UME 插件开发竞赛
防ddos攻击转发IP,棋牌游戏高防IP好用吗?
MySQL调整配置:不区分大小写
C add log4net log (console and file) to console application
[in simple terms and reinforcement learning] 2 Markov decision process
Go language learning notes - read lock reentry leads to deadlock