关于javascript:js常用for函数两种

这个文章随着当前的常识减少而在写吧!
现就这么多吧!

for语法2: index 代表下标 
for(let index in data){ 
console.log("测试for循环") 
let user = data[index]; 
alert(user.name); 
}
for语法3: user以后循环遍历的对象 
for(let user of data){ 
console.log("for循环测试:"+user.name); 
}

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理