function?test(){??
for(var?i=0;i<3;i++){??
????var?what?=?"haha";???
??}?console.log(what);??
}??
test();上面這個打印what可以出來hahafunction?enen(){
????var?that?=?"lala";
}
console.log(that);這個則打印不出來,顯示that未定義按照作用域說的,what應(yīng)該打印不出來吧?按照沒有塊級作用域說的話,that不是應(yīng)該打印出來嗎?我已經(jīng)暈了!
關(guān)于JS的作用域和沒有塊級作用域這個,小弟有點蒙圈了,求敲醒!
lovecherry
2015-10-12 21:14:15