标签:val 数组 code 方法 for循环 es5 jave col item
遍历出数组中每个值的键(下标)
let arr = [1, 2, 3, 4, 5, 6, 7, 8]; for (let item of arr) { console.log(item); }
let arr = [1, 2, 3, 4, 5, 6, 7, 8]; for (let item of arr.keys()) { console.log(item); }
let arr = [1, 2, 3, 4, 5, 6, 7, 8]; for (let item of arr. values()) { console.log(item); }
标签:val 数组 code 方法 for循环 es5 jave col item
原文地址:https://www.cnblogs.com/zxq519896763/p/12184450.html