Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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 
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #set #property #object #array #objects
ADD COMMENT
Topic
Name
2+8 =