DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR JAVASCRIPT
es6 convert array to object
const result = arr.reduce((obj, cur) => ({...obj, [cur.sid]: cur}), {})
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#convert
#array
#object
ADD COMMENT
Topic
COMMENT
Name
4+2 =
Submit