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

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

}
主站蜘蛛池模板: 临潭县| 中山市| 施秉县| 凤山县| 同心县| 华阴市| 琼海市| 海阳市| 吐鲁番市| 海丰县| 和顺县| 安乡县| 玉山县| 读书| 南靖县| 会理县| 双江| 光泽县| 宝兴县| 吴江市| 巴青县| 新巴尔虎右旗| 阿尔山市| 田林县| 会泽县| 玛多县| 古浪县| 宁河县| 珲春市| 丹江口市| 马山县| 石渠县| 靖远县| 通化市| 鄂托克旗| 开鲁县| 石景山区| 木兰县| 巴林右旗| 武强县| 平谷区|