I have a DB with some info in and a function that accesses that info. However, using an old DB I have returned a perfect bidimensional array, so I can use it with no problems at all. Now, with the new DB info, for some reason I am receiving some data in the right way and some other data as an object:
World goes from 0 to 149 and each of them do the same, so I have
0 0 [1,1,1]
0 1 [1,1,1] etc
but in positions 2 and 47, instead of an array of arrays, I have an object:
2: {0 [1,1,1] ...
The whole idea is to put everything into a bidimensional array:
[[1,1,1],[1,1,1],...],[[1,1,1],[1,1,1],...]
I have tried a few things like Array.from but it seems like since it has a mix between it won´t be converted.
What should I do to convert it the right way or to access only those wich are objects, convert them, then add every element in its right position to a bidimensional array?
(I tried to explain it the best way I can... let me know if there is any other explanation you may need to help me out overhere)
Thanks! ps: The info comes from an API
This is what I get:
world
Object { 0=[150], 1=[150], 2={...}, más...}
0
[1, 1, 1, 147 más...]
1
[1, 1, 1, 147 más...]
2
Object { 0=1, 1=1, 2=1, más...}
3
[1, 1, 1, 147 más...]
4
[1, 1, 1, 147 más...]
5
[1, 1, 1, 147 más...]
6
[1, 1, 1, 147 más...]
7
[1, 1, 1, 147 más...]
8
[1, 1, 1, 147 más...]
9
[1, 1, 1, 147 más...]
10
[1, 1, 1, 147 más...]
This is what I need:
world
[[1, 1, 1, 147 más...], [1, 1, 1, 147 más...], [1, 1, 1, 147 más...], 147 más...]
0
[1, 1, 1, 147 más...]
1
[1, 1, 1, 147 más...]
2
[1, 1, 1, 147 más...]
3
[1, 1, 1, 147 más...]
4
[1, 1, 1, 147 más...]
5
[1, 1, 1, 147 más...]
6
[1, 1, 1, 147 más...]
7
[1, 1, 1, 147 más...]
8
[1, 1, 1, 147 más...]
9
[1, 1, 1, 147 más...]
10
[1, 1, 1, 147 más...]