So I am trying to populate a single object. My data looks like this right now:
[ { 'id1':
{ name: 'K Mmm',
time: '1583308800/1583395199',
ref: 'JK92fYxGmCofsWa1DMDMKXSo/JK92fYxGmCofsWa1DMDMKXSo' } },
{ 'id2':
{ name: 'Bb Bb',
time: '1583125200/1583222399',
ref: 'JK92fYxGmCofsWa1DMDMKXSo/JK92fYxGmCofsWa1DMDMKXSo' } } ]
And I would like it to look like this:
{'id1':
{ name: 'K Mmm',
time: '1583308800/1583395199',
ref: 'JK92fYxGmCofsWa1DMDMKXSo/JK92fYxGmCofsWa1DMDMKXSo' } ,
'id2':
{ name: 'Bb Bb',
time: '1583125200/1583222399',
ref: 'JK92fYxGmCofsWa1DMDMKXSo/JK92fYxGmCofsWa1DMDMKXSo' } ,
... }
The problem is that I am getting a object in a for
loop, is there any way to populate an object from scratch?
Right not I am pushing to Array with .push().
Like push but to a object instead to an array?