In firebug, does anyone know why the length = 0 in the first line and when I click on it to expand, it says that the length = 3.. Shouldnt both be equal? SAme goes with models:Array[0] but in the expand version it is Array[3]

firebug screenshot

有帮助吗?

解决方案

The console log captures the current state of the object, the later update of the object is reflected when you expand it. You can try in console the below to see how it behaves.

  var test = {length:0,models:[]};
   console.log(test);
   test.length =4;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top