i have this array of strings :
let myArray : [\"AA\",\"BB\" , \"CC\" ...]
I want to convert it to an array of obje
You can use .map() for this. It passes the index into the callback.
.map()
myArray = myArray.map((str, index) => ({ value: str, id: index + 1 }));