keys 遍歷每一項(xiàng)的接口,使用for of 遍歷
/*
* keys 遍歷每一項(xiàng)的接口,使用for of 遍歷
*
* */
let aryKeys = [1,2,3,4,5];
for(let item of aryKeys.keys()){
console.log('可以遍歷for of的下標(biāo)', item);
}
可以遍歷for of的下標(biāo) 0
可以遍歷for of的下標(biāo) 1
可以遍歷for of的下標(biāo) 2
可以遍歷for of的下標(biāo) 3
可以遍歷for of的下標(biāo) 4
2.數(shù)組原型上的擴(kuò)展方法.html?_ijt=4c7g84feknv8l8hgbrkv2ghsl6:108 可以遍歷for of的下標(biāo) 1
2.數(shù)組原型上的擴(kuò)展方法.html?_ijt=4c7g84feknv8l8hgbrkv2ghsl6:108 可以遍歷for of的下標(biāo) 2
2.數(shù)組原型上的擴(kuò)展方法.html?_ijt=4c7g84feknv8l8hgbrkv2ghsl6:108 可以遍歷for of的下標(biāo) 3
2.數(shù)組原型上的擴(kuò)展方法.html?_ijt=4c7g84feknv8l8hgbrkv2ghsl6:108 可以遍歷for of的下標(biāo) 4
2entries 遍歷接口,可以遍歷到索引的每一項(xiàng),每一次遍歷得到一個(gè)數(shù)組【索引,當(dāng)前項(xiàng)】
/*
* entries 遍歷接口,可以遍歷到索引的每一項(xiàng),每一次遍歷得到一個(gè)數(shù)組【索引,當(dāng)前項(xiàng)】
*
* */
for(let e of aryKeys.entries()){
console.log('entries【索引,當(dāng)前項(xiàng)】',e);
}

image.png
3
//默認(rèn)使用for of 遍歷數(shù)組,默認(rèn)遍歷的就是每一個(gè)項(xiàng)
for(let it of aryKeys){
console.log('for of每一個(gè)項(xiàng)',it);
}