Is it possible to assign a distinct identifier to every element in the JSON array with JavaScript?
[
{ name: 'Yosi'},
{ name: 'Ben' },
{ name: 'Dan' },
{ name: 'Erez'}
]
Desired outcome:
[
{id: 1, name: 'yosii'},
{id: 2, name: 'ben'},
...
]