代碼如下function a () { var scope="global"; ? function t(){ ?? ? console.log(scope); ?? ? var scope="local" ?? ? console.log(scope); ? } ? t();}a();如此 控制臺輸出 undefined 和local但是如果去掉“?var scope="local" ?,?console.log(scope); ”,function a () {var scope="global"; ?function t(){ ?? ? console.log(scope); ?} ?t();}a();控制臺輸出為global ? 這是為什么
js問題,求解
諾森德的凜冽寒風
2015-04-15 17:16:17