for (const k in v){ 变量作用域

for (const k in v){
 
 
 

const a=[11,22,33,44]
for(let i in a ){
console.log(i)
i=i+1
}
console.log('---')
for(const i in a ){
console.log(i)
i=i+1
}

 

VM64:3 0
VM64:3 1
VM64:3 2
VM64:3 3
VM64:6 ---
VM64:8 0
VM64:9 Uncaught TypeError: Assignment to constant variable.
at <anonymous>:9:2

 

 

 

 

posted @ 2018-09-10 21:26  papering  阅读(879)  评论(0编辑  收藏  举报