0

I want to set for example :

myarray[3922] = {
    name : 'john'
    family : 'doe'
}

which did not make null indices like this :

myarray[0] = null

myarray[1] = null

.

.

.

myarray[3920] = null

myarray[3921] = null

myarray[3922 = { name : 'john' family : 'doe' }

so that I can have direct access to myarray[3922].name .

I use these for saving in localStorage, like this: how to set value to some desired index of array in javascript?

thanks in advance

3
  • 1
    Just don't use an array. Use an object instead. Commented Sep 4, 2022 at 5:29
  • I don't found any source of how to make that object for direct access Commented Sep 4, 2022 at 5:31
  • 1
    What's wrong with this answer to your previous question? Commented Sep 4, 2022 at 5:31

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.