Implement Array-like behavior in JavaScript without using Array
问题 Is there any way to create an array-like object in JavaScript, without using the built-in array? I'm specifically concerned with behavior like this: var sup = new Array(5); //sup.length here is 0 sup[0] = 'z3ero'; //sup.length here is 1 sup[1] = 'o3ne'; //sup.length here is 2 sup[4] = 'f3our'; //sup.length here is 5 The particular behavior I'm looking at here is that sup.length changes without any methods being called. I understand from this question that the [] operator is overloaded in the