I have an array received from backend: ["Drake","Ola","d"]
, now I need to assign all these values the same key which is id
so it looks something like this:
[{id: "Drake"}, {id: "Ola"}, {id: "d"}]
I need a function to do this as the data is gotten after the page has loaded and I have tried many techniques including for loops
.
I can also use JQuery if necessary, whats the solution please?