标签:for class log dex 遍历 script pre value val
keys()
是对键名的遍历、
values()
是对键值的遍历
entries()
是对键值对的遍历。
for (let index of [‘a‘, ‘b‘].keys()) { console.log(index); } // 0 // 1 for (let elem of [‘a‘, ‘b‘].values()) { console.log(elem); } // ‘a‘ // ‘b‘ for (let [index, elem] of [‘a‘, ‘b‘].entries()) { console.log(index, elem); } // 0 "a" // 1 "b"
标签:for class log dex 遍历 script pre value val
原文地址:https://www.cnblogs.com/blogZhao/p/12560635.html