Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js map array to dictionary

// Convert array string to dictionary, ex: ['choice_a', 'choice_b'] => {choice_a: true, choice_b: true }
const paramsChecked = Object.assign({}, ...listChecked.map((x) => ({[x]: true})))
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #js #map #array #dictionary
ADD COMMENT
Topic
Name
5+2 =