4

可能重复:
Chrome 的 JavaScript 控制台是否懒于评估数组?

对于这个匿名函数,我有不同的输出,这取决于我使用的是 Chrome 开发者控制台还是 Firefox Firebug。为什么会这样?

(function(){
var t =["one","two"];
    console.log(t)

function a(m){
    t[2]="three";
    console.log(t)
};a(t)

function b(n){
    t[3]="four";
    console.log(t)
};b(t)
}())
["one", "two", "three", "four"]
["one", "two", "three", "four"]
["one", "two", "three", "four"] // chrome output

["one", "two"]
["one", "two", "three"]
["one", "two", "three", "four"]// firebug output
4

0 回答 0