I'm having an object of arrays. So I was trying to access one of the properties based on a randomly generated key but the result isn't accurate (Notice index 7 in the image below).
But when I try to access it without a randomly generated key, it displays correctly:
NOTE My original object looks Like this:
const obj = {
"25": [
[{}, {}, {}, {}, {}],
[{}, {}, {}, {}, {}],
[{}, {}, {}, {}, {}],
],
"26": [
[{}, {}, {}, {}, {}],
[{}, {}, {}, {}, {}],
[{}, {}, {}, {}, {}],
],
"27": [
[{}, {}, {}, {}, {}],
[{}, {}, {}, {}, {}],
[{}, {}, {}, {}, {}],
],
...to "50"
}
So, I was trying to access one of the keys based on a random number as mentioned above e.g obj[randomNumber]
, this didn't display correctly, but this obj[26]
works.
What could cause this and how do I rectify it?
I'm ready to provide more explanations.
Aucun commentaire:
Enregistrer un commentaire