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

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

}
主站蜘蛛池模板: 常山县| 蛟河市| 宁河县| 天长市| 曲阳县| 麻栗坡县| 西充县| 柳河县| 武隆县| 徐州市| 眉山市| 宜州市| 阜城县| 马鞍山市| 尼玛县| 兴海县| 铜山县| 资讯 | 廉江市| 黄浦区| 洪江市| 阳江市| 汶川县| 海晏县| 枣强县| 托里县| 锦州市| 松溪县| 阳朔县| 胶南市| 平潭县| 峨山| 吉隆县| 静安区| 彭泽县| 沁水县| 什邡市| 夏津县| 伊金霍洛旗| 丰都县| 廊坊市|