- Hands-On Machine Learning with JavaScript
- Burak Kanber
- 79字
- 2021-06-25 21:38:19
The for...of function
The for loops over arrays in ES5 are often achieved using the for (index in array) syntax, which looks something like this:
var items = [1, 2, 3 ];
for (var index in items) {
var item = items[index];
…
}
And ES6 adds the for...of syntax, which saves you a step, as you can see from the following code:
const items = [1, 2, 3 ];
for (const item of items) {
…
}
推薦閱讀
- 大學計算機基礎:基礎理論篇
- SCRATCH與機器人
- 網上沖浪
- 數據庫原理與應用技術學習指導
- 工業機器人工程應用虛擬仿真教程:MotoSim EG-VRC
- 永磁同步電動機變頻調速系統及其控制(第2版)
- OpenStack Cloud Computing Cookbook(Second Edition)
- 數據庫系統原理及應用教程(第5版)
- LAMP網站開發黃金組合Linux+Apache+MySQL+PHP
- Windows Server 2003系統安全管理
- Silverlight 2完美征程
- 網絡服務器搭建與管理
- 數據要素:全球經濟社會發展的新動力
- Cloudera Hadoop大數據平臺實戰指南
- 西門子S7-1200/1500 PLC從入門到精通