Search
 
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
Name
4+2 =