Array bug?
Posted: Fri Dec 10, 2010 11:16 am
Hi all,
If I fill an array in this way:
And I check the ".length",I obtain 8 but the elements are 7!
if,instead,I create the array with the code:
Then the ".length" returns the right number(7).
Maybe something wrong with the array index that start from 1 and end with 7? Or I'm forgotten something?
Here a sample:
If I fill an array in this way:
- Code: Select all
for(var i=1;i<=7;i++)
_myArray[i] = i;
And I check the ".length",I obtain 8 but the elements are 7!
if,instead,I create the array with the code:
- Code: Select all
var _myArray = new Array(1,2,3,4,5,6,7)
Then the ".length" returns the right number(7).
Maybe something wrong with the array index that start from 1 and end with 7? Or I'm forgotten something?
Here a sample: