一個非常奇怪的問題。是javascript還是firefox異步的console.dir()?
在我的調試中,我發現console.dir(anArray)沒有在瀏覽器的firebug控制檯上輸出當前值。
例如,
console.dir(anArray) //line 1
console.log(anArray[0].prop1) //line 2
code to change the value of anArray[0].prop1 //line 3
的anArray是JavaScript的/ JSON對象的陣列,
在Firbug的控制檯,線1所輸出的新值,這是在第3行設置,
和第2行是舊值,是我想要的。
唯一的解釋是console.dir()是異步的,對吧?!
我ENV: Windows7中,火狐6.0.2,1.9.1螢火蟲,JavaScript的LIB是道場(但我認爲沒有什麼用它做。)
感謝。