I wounder why can't I access array item by index? I've created global array just like this:
var myArr=[];
Then in a function I've used a simple loop to fill it with numbers from 1 to 10 just in test purposes. It seems it is filled because if I call
console.log(myArr);
But if I try to use indexes in the same console call
console.log(myArr[2]);
It returns undefined and also myArr.length returns 0
Why??

var arr = [0,1,2,3,4,5,6,7,8]; console.log(arr[1]); console.log(arr.length);console.log(JSON.stringify(myArr)), that will show you what it is at the time that its being logged