|
Is this an expected result or a bug?
When the array has holes — nil elements inside it — the length operator may assume any of these nil elements as the end marker. Of course, this unpredictability is hardly what you want. Therefore, you should avoid using the length operator on arrays that may contain holes.