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