0

I have an array which is printed as follows in the console. Not able to access its values, by

array[0]

but it has 4 elements. How to access these values and iterate?

15
  • 1
    what error do you see when you try to use array[0] ? Commented Jul 17, 2018 at 12:20
  • This question needs a minimal reproducible example Commented Jul 17, 2018 at 12:21
  • 1
    From the screenshot, we can tell that as of when you did console.log, the array was empty, but later, when you expanded that entry in the console, it had four entries. See the linked question and its answers for details. So you'll need to find out what event or similar you need to respond to that occurs when the array has had entries added to it (or post a minimal reproducible example so we can help you figure it out). Commented Jul 17, 2018 at 12:22
  • 1
    @LGSon — No. That shows it contains 4 things. There's nothing to suggest those things are arrays. We can see what they are: They are all numbers. Commented Jul 17, 2018 at 12:23
  • @LGSon can you post how the data is var arr = [5,6,7] or var nestedArr = [ [8,9],[10,11],[12,13] ] Commented Jul 17, 2018 at 12:25

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.