DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
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
COMMENT
Name
9+9 =
Submit