Home > database >  How to get the n-th item of a javascript list [closed]
How to get the n-th item of a javascript list [closed]

Time:10-05

I'm working on something where I need to go through each item of a javascript list by number, get the name AND value of each item, and then do something with that. The list looks like this:

{"test-item-1": false, "test-item-2": false, "test-item-3": false}

I don't know what order the items will be in though, or even what items there are. So I have to find each item by number. Can anyone help me figure out how to do that?

CodePudding user response:

const array = JSON.parse(arrayJSON)
const item = array[n]
  • Related