First point:
var lennon =Array();
lennon["name"]="windy";
lennon["year"]="1989";
lennon["living"]=true;
alert( lennon.length);
Result: lennon.length is 0
Cause:
Increasing array elements in the following way will not change the length of the array
arr["a"]=3;
Second point:
var foo2 = [];
foo2['3'] = 3;
foo2['age'] = 20;
debugger;
alert (foo2.length);
foo2.length is 4 again
All array objects without assignment will be defined as undefined
JavaScript can automatically resize arrays. This automatic resizing mechanism makes out-of-bounds arrays more likely to occur and harder to detect. So pay extra attention to situations like this.