官术网_书友最值得收藏!

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) {

}
主站蜘蛛池模板: 石渠县| 铜川市| 洛阳市| 密云县| 金堂县| 大悟县| 高邮市| 精河县| 平定县| 泾源县| 南京市| 庆城县| 庆元县| 罗源县| 四川省| 武功县| 翁牛特旗| 新化县| 勐海县| 尉犁县| 报价| 韶山市| 搜索| 桐城市| 成都市| 如东县| 兰溪市| 绥芬河市| 新巴尔虎左旗| 曲水县| 大渡口区| 舟山市| 余姚市| 即墨市| 靖江市| 隆安县| 花莲县| 镇康县| 乌拉特中旗| 东乌珠穆沁旗| 深圳市|