Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

es6 array to object keys

const subLocationTypes = (location.subLocationTypes || []).reduce((add, cur) => {
add[cur.key] = cur.value;
return add;
}, {});
 
PREVIOUS NEXT
Tagged: #array #object #keys
ADD COMMENT
Topic
Name
8+7 =