Cant access returned array data

  angular, arrays, javascript

I have a function that returns an array of arrays this works and returns as expected. When I console.log the array it shows

[]
0: Array(2)
0: "count"
1: "name"
length: 2
__proto__: Array(0)
1: Array(44)
0: {0: "1", 1: "BLD", count: "1", name: "BLD"}
1: {0: "13", 1: "ARE", count: "13", name: "ARE"}
2: {0: "5", 1: "AIS", count: "5", name: "AIS"}
3: {0: "50", 1: "YRD", count: "50", name: "YRD"}
...

However if I then try and access the array or get its length I get undefined i.e.

console.log(array[0]) --- returns undefined
console.log(array[][0]) --- returns undefined
console.log(array[0]['name']) --- returns undefined
console.log(array.length())    --- returns 0

How can I retrieve the data within the array?

Source: Ask Javascript Questions

LEAVE A COMMENT