set part of object in array javascript code example
Example: javascript set property for each object in array of objects
let yourArray = [{id:3},{id:2},{id:4}]
yourArray.forEach((item, index) => {
item.id = index
})
let yourArray = [{id:3},{id:2},{id:4}]
yourArray.forEach((item, index) => {
item.id = index
})