Reputation: 89
I want to get the length of the first array in an array (should return 2010), but I can't seem to do so with .length. The picture attached is a snapshot of the console when I run:
console.log(marker)
When I try to run the following, it returns TypeError: Cannot read property 'length' of undefined.
console.log(marker[0].length)
//TypeError: Cannot read property 'length' of undefined
console.log(marker.length)
//returns 3
Can someone point me in the right direction? Can't seem to understand what's wrong.
Upvotes: 1
Views: 126
Reputation: 2244
Normally the issue with such types of unexpected results is the *blueish) small question mark on the right side. It means that the result was evaluated after your code finished executing, aka async issue.
I would suggest that you see in your code where the async call appears and await it.
Upvotes: 1