I have an array, say [{ id: 'first' }, { id: 'second' }]
Are there any native methods I'm missing that will convert the array into an array-like object? I've seen plenty of answers asking about the other direction, and recommending Array.prototype.slice.call
(or the newer Array.from
), but I can't find anyone asking about this. For the above example, I'd want to get the following output:
{
0: { id: 'first' }
1: { id: 'second' }
}