for(let index of [‘a’,‘b’,‘c’].keys()) //遍历数组的元素索引
for(let value of [‘a’,‘b’,‘c’].values()) //遍历数组的元素值 需polyfill兼容
for(let [index,value] of [‘a’,‘b’,‘c’].entries()) //遍历数组的index和value
ES6的for...of循环常用
最新推荐文章于 2024-01-21 10:58:40 发布
for(let index of [‘a’,‘b’,‘c’].keys()) //遍历数组的元素索引
for(let value of [‘a’,‘b’,‘c’].values()) //遍历数组的元素值 需polyfill兼容
for(let [index,value] of [‘a’,‘b’,‘c’].entries()) //遍历数组的index和value