I have an array of objects below. When I do a console.log, this is what I see:
[Object, Object, Object]
0:Object
name: "Rick"
Contact: "Yes"
1:Object
name:"Anjie"
Contact:"No"
2:Object
name:"dillan"
Contact:"Maybe"
Now, I want the array of objects to be updated as follows:
[Object, Object, Object]
0:Object
name: "Rick"
Contact: "Yes"
id: 1
1:Object
name:"Anjie"
Contact:"No"
id: 2
2:Object
name:"dillan"
Contact:"Maybe"
id:3
As you can see, I have added an id that auto-increments when a new object is present.
Could someone please provide guidance on how to achieve this dynamically?