- 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) {
…
}
推薦閱讀
- Ansible Quick Start Guide
- 基于LabWindows/CVI的虛擬儀器設計與應用
- 物聯網與云計算
- Photoshop CS3圖層、通道、蒙版深度剖析寶典
- RedHat Linux用戶基礎
- INSTANT Heat Maps in R:How-to
- INSTANT Puppet 3 Starter
- Mastering MongoDB 3.x
- 智能鼠原理與制作(進階篇)
- 智能制造系統及關鍵使能技術
- Machine Learning with Spark(Second Edition)
- 大話數據科學:大數據與機器學習實戰(基于R語言)
- 機器人手工制作
- Learning OpenShift
- Data Science with Python