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

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

}
主站蜘蛛池模板: 万全县| 丹东市| 怀柔区| 敦煌市| 沾益县| 新郑市| 湾仔区| 宜良县| 隆昌县| 岳池县| 汉阴县| 商南县| 五河县| 香格里拉县| 襄汾县| 保德县| 南乐县| 新乐市| 晴隆县| 望谟县| 德庆县| 高清| 阿合奇县| 鹿泉市| 军事| 平度市| 万源市| 东乌珠穆沁旗| 二连浩特市| 吉木乃县| 铁力市| 河西区| 沂水县| 丹江口市| 高州市| 射阳县| 门头沟区| 德清县| 河北省| 甘肃省| 五指山市|