// for in 与for of的区别
var arr = [{name:'zhanghui',age:18},{name:'zhangziyan',age:10}]
var obj = {name:'zhanghui',age:18}
var str = "abc"
for (i in arr){
console.log('for in arr 输出索引:'+ i)
}
console.log('+++++++++++++++++++++++++++++++++++')
for (i in obj){
console.log('for in obj 输出key:'+ i)
}
console.log('+++++++++++++++++++++++++++++++++++')
for (i in str){
console.log('for in str 输出索引:'+ i)
}
console.log('+++++++++++++++++++++++++++++++++++')
for (i of arr){
console.log('for of arr')
console.log(i)
}
console.log('+++++++++++++++++++++++++++++++++++')
console.log('for of 不能遍历对象')
console.log('+++++++++++++++++++++++++++++++++++')
for (i of str){
console.log('for of str输入每个字符:'+i)
}
console.log('+++++++++++++++++++++++++++++++++++')
console